﻿'********************************************************************************
'*
'*      WB　フォーム
'*
'*      File Name : frmStartCompleteWB.vb
'*      Title     : WB着工/完了履歴画面
'*      機能    　：WB工程
'*
'********************************************************************************
'----------------------------------<<修正履歴>>----------------------------------
'ﾊﾞｰｼﾞｮﾝ   日付       作業者        ｺﾒﾝﾄ
'--------- ---------- ------------ -----------------------------------------------
' V1.0.0   2016/07/12 S.Yu         新規作成
' V2.0.0   2017/05/17 horaguchi    蘇州対応
' V3.0.0   2017/12/22 M.Ohga       北京対応
' V4.0.0   2018/01/02 miao         北京対応
'********************************************************************************

Imports System.Text

Public Class frmStartCompleteWB

    ' 前工程ラックNo保持
    Dim preRackNoList As New List(Of String)

    ' b-Site取得カテゴリーとの比較文字列
    ' >> 2018/2/1 安部 WBAU,WBAG,WBCU の３種類を有効カテゴリに変更 RSB確認結果一覧：61 
    '    Private Const BSITE_CATEGORY_WIRE As String = "WBCU" '苗　1/3　WBAU→WBCU
    Private Const BSITE_CATEGORY_WIREAU As String = "WBAU" '苗　1/3　WBAU→WBCU
    Private Const BSITE_CATEGORY_WIREAG As String = "WBAG" '苗　1/3　WBAU→WBCU
    Private Const BSITE_CATEGORY_WIRECU As String = "WBCU" '苗　1/3　WBAU→WBCU
    Private Const BSITE_CATEGORY_CAPILLARY As String = "WBCP"
    ' << 2018/2/1 安部 WBAU,WBAG,WBCU の３種類を有効カテゴリに変更 RSB確認結果一覧：61 

    ' 外部画面呼び出しTAG
    Private Const EXEC_PG_TAG_WIRE As String = "WB_WIRE"
    Private Const EXEC_PG_TAG_CAPILLARY As String = "WB_CAPILLARY"

    '>>2018/1/31 佐川 キャリア交換対応
    '実行モード
    '0:表示 1:着工 2:製造完成 3:計上完成
    Private execMode As String = VIEW
    '<<2018/1/31 佐川 キャリア交換対応

    ' >> 20180712 佐川 ラックID入力追加
    Private inputCount As Integer = 0
    ' << 20180712 佐川 ラックID入力追加
    Private Const DP_CNT As String = "DP CNT"
    Private strDP_CNT As String = "0" 'ADD 苗 2018/1/25 既定値"0"を設定
    Private tmpRackNo As String

    Private tmpInRackNo As String
    Private tmpOutRackNo As String
    'Add Miaojf 2019/11/22 Begin

    Overrides Sub setProcessingLot()
        Dim InProcLot As String

        InProcLot = getProcessingLot()
        If InProcLot <> "" Then
            txtLotNo.Text = InProcLot
            txtLotNo_KeyPress(txtLotNo, New KeyPressEventArgs(vbCr))
            Dim inRackNo As String = ""
            Dim outRackNo As String = ""
            If m_cWBRackMng.getAutoMode(txtLotNo.Text, inRackNo, outRackNo, lblEquipID.Text) = "2" Then
                btnManual.PerformClick()
            End If
            txt0502.Text = inRackNo
            txt0602.Text = outRackNo
        End If

    End Sub

    Overrides Sub selectTab()

        tabBase.SelectedIndex = 2

        Me.UpdateStyles()
    End Sub
    'Public Overrides Sub SetFocus()

    'btnPreRackNo.Enabled = True
    'btnPreRackNo.PerformClick()
    'txt0502.Enabled = True
    'txt0502.Focus()
    'End Sub
    'Add Miaojf 2019/11/22 END

    ' 着工前チェック項目：線材、キャピラリ、着工前ラックNo、完了ラックNo、棚番号
    Enum SCORE_NUM As Integer
        WIRE
        CAPILLARY
        PRE_RACK_NO
        AFTER_RACK_NO
        'SHELF_NO
    End Enum

    '照合結果設定
    Public Overrides Sub SetPassScore()
        ' >> 20180712 佐川 ラックID入力追加
        '入力ラック数を追加
        PASS_SCORE = 5
        ReDim m_iScore(PASS_SCORE - 1)
        m_iScore = {PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK}
        ' << 20180712 佐川 ラックID入力追加
    End Sub
    Overrides Function chkMoveInByAutoMode() As Boolean
        Me.Refresh()
        If txt0502.Text = "" And tmpRackNo = "" Then
            Return False
        Else
            Return True
        End If

    End Function
    '照合結果クリア
    Public Overrides Sub InitualizeCollData()
        ' >> 20180712 佐川 ラックID入力追加
        m_iScore = {PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK, PASS_SCORE_WAIT_CHECK}
        ' << 20180712 佐川 ラックID入力追加
    End Sub
    Overrides Sub SetProcNo(ByRef procNo As String)
        m_szProc = PROC_CD_WBS
        procNo = PROC_CD_WBS
    End Sub

    'イベント設定
    Public Overrides Sub SetHandler()
        '画面初期化
        InputDataClear()

        ' 着工前ラックNo
        AddHandler btnPreRackNo.Click, AddressOf btnRackNo_Click 'btnRackCaseNoBarCode_Click’DEL miao 2018/8/15
        AddHandler txt0502.KeyPress, AddressOf txtData_KeyPressWB
        'AddHandler txt0502.LostFocus, AddressOf txtWB_LostFocus

        ' 完了ラックNo
        AddHandler btnAfterRackNo.Click, AddressOf btnRackNo_Click 'btnRackCaseNoBarCode_Click’DEL miao 2018/8/15
        AddHandler txt0602.KeyPress, AddressOf txtData_KeyPressWB
        'AddHandler txt0602.LostFocus, AddressOf txtWB_LostFocus

        ' 棚番号
        AddHandler btnShelfNo.Click, AddressOf btnRackCaseNoBarCode_Click
        AddHandler txt0902.KeyPress, AddressOf txtData_KeyPressWB
        'AddHandler txt0902.LostFocus, AddressOf txtWB_LostFocus

        ' フレーム数
        AddHandler lbl0702.Click, AddressOf TenKeyClick
        AddHandler lbl0703.Click, AddressOf TenKeyClick
        AddHandler lbl0704.Click, AddressOf TenKeyClick

        ' >> 20180712 佐川 ラックID入力追加
        AddHandler txt0503.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0503.LostFocus, AddressOf txtWB_LostFocus
        AddHandler txt0504.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0504.LostFocus, AddressOf txtWB_LostFocus
        AddHandler txt0505.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0505.LostFocus, AddressOf txtWB_LostFocus
        AddHandler txt0506.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0506.LostFocus, AddressOf txtWB_LostFocus
        AddHandler txt0603.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0603.LostFocus, AddressOf txtTenkey_LostFocus
        AddHandler txt0604.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0604.LostFocus, AddressOf txtTenkey_LostFocus
        AddHandler txt0605.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0605.LostFocus, AddressOf txtTenkey_LostFocus
        AddHandler txt0606.KeyPress, AddressOf txtData_KeyPressWB
        AddHandler txt0606.LostFocus, AddressOf txtTenkey_LostFocus
        ' >> 20180712 佐川 ラックID入力追加
        ' >> 20180712 佐川 ラックNo途入力改善
        AddHandler txt0502.Click, AddressOf rackInputFocus
        AddHandler lbl0502.Click, AddressOf rackInputFocus
        AddHandler txt0503.Click, AddressOf rackInputFocus
        AddHandler lbl0503.Click, AddressOf rackInputFocus
        AddHandler txt0504.Click, AddressOf rackInputFocus
        AddHandler lbl0504.Click, AddressOf rackInputFocus
        AddHandler txt0505.Click, AddressOf rackInputFocus
        AddHandler lbl0505.Click, AddressOf rackInputFocus
        AddHandler txt0506.Click, AddressOf rackInputFocus
        AddHandler lbl0506.Click, AddressOf rackInputFocus
        AddHandler txt0602.Click, AddressOf rackInputFocus
        AddHandler lbl0602.Click, AddressOf rackInputFocus
        AddHandler txt0603.Click, AddressOf rackInputFocus
        AddHandler lbl0603.Click, AddressOf rackInputFocus
        AddHandler txt0604.Click, AddressOf rackInputFocus
        AddHandler lbl0604.Click, AddressOf rackInputFocus
        AddHandler txt0605.Click, AddressOf rackInputFocus
        AddHandler lbl0605.Click, AddressOf rackInputFocus
        AddHandler txt0606.Click, AddressOf rackInputFocus
        AddHandler lbl0606.Click, AddressOf rackInputFocus
        ' << 20180712 佐川 ラックNo途入力改善
    End Sub

    ' コントロールがある場合に文字列を設定
    Private Sub setLabel(ByVal setLabel As Control(), ByVal text As String)
        If setLabel.Length > 0 Then
            setLabel(0).Text = text
        End If
    End Sub

    ' 情報タブの一覧反映
    Private Function makeRackListView() As Boolean

        If IsNothing(IcTag.szLotNo) Then Exit Function
        preRackNoList.Clear() 'ADD 苗 2018/2/1
        Dim rackMng = m_cWBRackMng.GetTableData(IcTag.szLotNo)
        If rackMng.Rows.Count = 0 Then
            Return False
        Else
            If preRackNoList.Count = 0 Then
                For Each itemPreRack In rackMng.Rows
                    preRackNoList.Add(itemPreRack("CONSTRUCTION_RACK"))
                Next
            End If
            ' 情報タブ 一覧に設定
            For Each rackdata In rackMng.AsEnumerable.Select(Function(val, i) New With {val, i})
                setLabel(Me.Controls.Find(String.Format("lblBeforeRack{0}", rackdata.i + 1), True), DBNullTOblank(rackdata.val("CONSTRUCTION_RACK"))) 'UPD MIAO 2018/10/22
                setLabel(Me.Controls.Find(String.Format("lblAfterRack{0}", rackdata.i + 1), True), DBNullTOblank(rackdata.val("COMPLETION_RACK"))) 'UPD MIAO 2018/10/22
                setLabel(Me.Controls.Find(String.Format("lblFrameNum{0}", rackdata.i + 1), True), DBNullTOblank(rackdata.val("FRAME_NUM"))) 'UPD MIAO 2018/10/22
                setLabel(Me.Controls.Find(String.Format("lblErrInnNum{0}", rackdata.i + 1), True), DBNullTOblank(rackdata.val("ERR_INN_NUM"))) 'UPD MIAO 2018/10/22
                setLabel(Me.Controls.Find(String.Format("lblErrInnFrmNum{0}", rackdata.i + 1), True), DBNullTOblank(rackdata.val("ERR_INN_FRM_NUM"))) 'UPD MIAO 2018/10/22
                setLabel(Me.Controls.Find(String.Format("lblEquipId{0}", rackdata.i + 1), True), DBNullTOblank(rackdata.val("EQUIP_ID"))) 'UPD MIAO 2018/10/22
            Next
            Return True
        End If

    End Function

    'Lot Noでデータベースからデータを取得する
    Public Overrides Sub GetDataByIcTag()
        m_RackWidthCheck = 1 'ADD 苗 2018/1/27 ラック桁数チェック

        Button2.Enabled = True 'ADD 苗 2018/2/27 NBIGS呼出ボタンの使用可にする
        MyBase.lblEmptyChipsCnt = lblEmptyChips
        '初期化
        InputDataClear()

        'ICタグのデータで画面を設定する
        SetFromTag()
        If m_MoveInCheck = False Then
            PutLog(Me.ToString, "initializForm", " m_MoveInCheck = False") '2020/8/8 ver.58
            initializForm()

            Exit Sub
        End If
        setGridViewLot()

        If String.IsNullOrEmpty(IcTag.szUID) Then
            IcTag = LastTag
        End If
        WIRETimer.Enabled = False
        '条件テーブル取得
        setJyokenData()
        'ADD 苗 2018/1/15 BEGIN 追加前、削除する
        'If IcTag.Status = ProcessStatus.Ready Then
        '    m_cWBRackMng.delOldData(IcTag.szLotNo)
        'End If
        'ADD 苗 2018/1/15 END 追加前、削除する
        '製造条件の設定
        For Each dr In dtJyokenData.Rows
            If DBNullTOblank(dr("KOMOKUNAME")).Equals(lbl0100.Tag) Then 'UPD MIAO 2018/11/1
                lbl0102.Text = DBNullTOblank(dr("KOMOKUDATA")) 'UPD MIAO 2018/11/1
            ElseIf DBNullTOblank(dr("KOMOKUNAME")).Equals(lbl0300.Tag) Then 'UPD MIAO 2018/11/1
                lbl0302.Text = DBNullTOblank(dr("KOMOKUDATA")) 'UPD MIAO 2018/11/1
            ElseIf DBNullTOblank(dr("KOMOKUNAME")).Equals(lblTitleAlumi.Tag) Then 'UPD MIAO 2018/11/1
                lblAlumi.Text = DBNullTOblank(dr("KOMOKUDATA")) 'UPD MIAO 2018/11/1
            End If
        Next

        If Not makeRackListView() Then
            'ラック管理が空の場合は新規登録
            preRackNoList = New List(Of String)

            '前工程 ラックNo
            '>>2018/1/31 佐川 キャリア交換対応
            preRackNoList.Add(IcTag.container1)
            preRackNoList.Add(IcTag.container2)
            preRackNoList.Add(IcTag.container3)
            preRackNoList.Add(IcTag.container4)
            preRackNoList.Add(IcTag.container5)
            'Dim drPreRack = dtPreDetailData.AsEnumerable.Where(Function(x) x("MNF_CND_TAG").Equals(lbl0600.Tag)).ToList
            'For Each itemPreRack In drPreRack.Select(Function(Value, Index) New With {Value, Index})
            '    'UPD 苗 2018/1/9 BEGIN
            '    If itemPreRack.Value("ACTUAL_MODEL") <> "" Then
            '        Debug.WriteLine(String.Format("{0} : {1}", itemPreRack.Index, itemPreRack.Value("ACTUAL_MODEL")))
            '        preRackNoList.Add(itemPreRack.Value("ACTUAL_MODEL"))
            '    End If
            '    'UPD 苗 2018/1/9 END
            'Next
            '<<2018/1/31 佐川 キャリア交換対応
            m_cWBRackMng.InsertRackData(IcTag.szLotNo, TagProcessStatus.Ready, preRackNoList)
            ' 情報タブ 一覧に設定
            For Each rackNo In preRackNoList.Select(Function(val, i) New With {val, i})
                setLabel(Me.Controls.Find(String.Format("lblBeforeRack{0}", rackNo.i + 1), True), rackNo.val)
            Next
        End If

        '工程明細テーブル取得
        setDetailData()
        If dtDetailData.Rows.Count = 0 Then
            Dim dblstatus = getMutliStatus()
            If dblstatus = ProcessStatus.TempComplete Then
                dtDetailData = m_cEquipMat.GetDetailResult(lotNo, m_szProc, TOTAL, m_szTable)
            ElseIf dblstatus = ProcessStatus.TempProcessing Then
                m_ProcessStatus = ProcessStatus.TagSet 'ADD 苗 2018/1/23
                IcTag.Status = TagProcessStatus.Processing 'ADD 苗 2018/1/23
                dtDetailData = m_cEquipMat.GetDetailResult(lotNo, m_szProc, BEGIN, m_szTable)
                ' >> 20180712 佐川 ラックID入力追加
                ' >> 20180309 大賀 着工中のデータをWBラック管理テーブルから取得するように修正
                Dim processingDetail As DataTable = Nothing
                Try
                    processingDetail = m_cWBRackMng.getDetailData(lotNo, BEGIN, g_EQUIP_NO) ', tmpRackNo)
                Catch
                    processingDetail = Nothing
                End Try
                If processingDetail IsNot Nothing Then
                    For i = 0 To processingDetail.Rows.Count - 1
                        'txt0502.Text = processingDetail(i)("CONSTRUCTION_RACK")
                        'txt0602.Text = processingDetail(i)("COMPLETION_RACK")
                        Dim rackText As Control() = Me.Controls.Find(String.Format("txt050{0}", i + 2), True)
                        CType(rackText(0), TextBox).Text = DBNullTOblank(processingDetail(i)("CONSTRUCTION_RACK")) 'UPD MIAO 2018/11/1
                        '完了ラックNoの入力数確認
                        Dim afterRackText As Control() = Me.Controls.Find(String.Format("txt060{0}", i + 2), True)
                        CType(afterRackText(0), TextBox).Text = DBNullTOblank(processingDetail(i)("COMPLETION_RACK")) 'UPD MIAO 2018/11/1
                        If i = 0 Then
                            lbl0702.Text = DBNullTOblank(processingDetail(0)("FRAME_NUM"))
                            lbl0703.Text = DBNullTOblank(processingDetail(0)("ERR_INN_NUM"))
                            lbl0704.Text = DBNullTOblank(processingDetail(0)("ERR_INN_FRM_NUM"))
                        End If

                    Next
                End If
                ' << 20180309 大賀 着工中のデータをWBラック管理テーブルから取得するように修正
                ' << 20180712 佐川 ラックID入力追加
            End If
        End If

        '明細データの設定
        If IcTag.Status <> TagProcessStatus.Ready Then 'ADD 苗 2018/1/13
            For Each dr In dtDetailData.Rows
                If DBNullTOblank(dr("MNF_CND_TAG")).Equals(lbl0100.Tag) Then 'UPD MIAO 2018/11/1
                    '線材
                    lbl0103.Text = DBNullTOblank(dr("ACTUAL_MODEL"))
                    lbl0104.Text = DBNullTOblank(dr("MATERIAL_LOT"))
                    lbl0106.Text = DBNullTOblank(dr("LIMIT_TIME"))
                ElseIf DBNullTOblank(dr("MNF_CND_TAG")).Equals(lbl0300.Tag) Then 'UPD MIAO 2018/11/1
                    'キャピラリ
                    lbl0303.Text = DBNullTOblank(dr("ACTUAL_MODEL")) 'UPD MIAO 2018/11/1
                    ' >> 20180309 大賀 着工中のデータをWBラック管理テーブルから取得するように修正
                    'ElseIf dr("MNF_CND_TAG").Equals(lbl0500.Tag) Then
                    '    If dr("MANAGEMENT_NO").Equals(g_EQUIP_NO) Then 'UPD 苗 2018/1/19 装置No.の対応
                    '        'ラックNo
                    '        txt0502.Text = dr("ACTUAL_MODEL")
                    '    End If
                    'ElseIf dr("MNF_CND_TAG").Equals(lbl0600.Tag) Then
                    '    If dr("MANAGEMENT_NO").Equals(g_EQUIP_NO) Then 'UPD 苗 2018/1/19 装置No.の対応
                    '        'ラックNo
                    '        txt0602.Text = dr("ACTUAL_MODEL")
                    '    End If
                    'ElseIf dr("MNF_CND_TAG").Equals(lbl0700.Tag) Then
                    '    If dr("MANAGEMENT_NO").Equals(g_EQUIP_NO) Then 'UPD 苗 2018/1/19 装置No.の対応
                    '        'フレーム数
                    '        lbl0702.Text = dr("ACTUAL_MODEL")
                    '    End If
                    'ElseIf dr("MNF_CND_TAG").Equals(lblERRInnNum.Tag) Then
                    '    If dr("MANAGEMENT_NO").Equals(g_EQUIP_NO) Then 'UPD 苗 2018/1/19 装置No.の対応
                    '        'フレーム数
                    '        lbl0703.Text = dr("ACTUAL_MODEL")
                    '    End If
                    'ElseIf dr("MNF_CND_TAG").Equals(lblERRInnFrmNum.Tag) Then
                    '    If dr("MANAGEMENT_NO").Equals(g_EQUIP_NO) Then 'UPD 苗 2018/1/19 装置No.の対応
                    '        'フレーム数
                    '        lbl0704.Text = dr("ACTUAL_MODEL")
                    '    End If
                    ' << 20180309 大賀 着工中のデータをWBラック管理テーブルから取得するように修正
                End If
            Next
        End If 'ADD 苗 2018/1/13

        '棚番号
        txt0902.Text = m_cWBRackMng.GetShelfAdrFC(IcTag.szLotNo)
        If Not String.IsNullOrEmpty(txt0902.Text) Then
            ' 入力済みに設定
            'txt0902.BackColor = ENTERED_INIT_COLOR
            'lbl0902.BackColor = ENTERED_INIT_COLOR
            txt0902.Enabled = False '苗 2018/1/6
            'm_iScore(SCORE_NUM.SHELF_NO) = PASS_SCORE_CHECKED
        Else '苗 2018/1/6
            '棚番号を棚システムから取得する。
            'txt0902.Text = m_cWBRackMng.GetShelfAdrFC(IcTag.szLotNo) 'ADD　苗　2019/12/1
            'm_iScore(SCORE_NUM.SHELF_NO) = PASS_SCORE_CHECKED 'ADD　苗　2019/12/4
            txt0902.Enabled = True '苗 2018/1/6
        End If

        '作業場所設定
        mLocationCode = m_cWBRackMng.getLocationCode(IcTag.szLotNo)

        '工程ヘッダーテーブル取得
        getHeadData()

        'ヘッダーの設定
        With m_dtMat
            If .Rows.Count > 0 Then
                '着完情報
                DisplayDate()
            Else
                If m_dtMat.Columns.Count > 0 Then
                    .Rows.Add()
                Else
                    .Columns.Add("BEGIN_TIME")
                    .Rows.Add()
                End If
            End If
        End With

        ' 着工前の場合はb-Site連携を行う
        'If IcTag.Status = TagProcessStatus.Ready Or btnStart.Text = getMsgStr("MSG10014") Then
        getBsiteData()
        ' 着工中の場合は，タイマーをスタートさせる
        If IcTag.Status <> TagProcessStatus.Ready Then
            WIRETimer.Enabled = True
        End If
        ' End If
        'Call resetStatus() 'ADD 苗 2018/1/6
        RandCheckFLAG = True
    End Sub

    '初期化、背景色の設定
    Public Sub InputDataClear()
        '>>2018/1/31 佐川 キャリア交換対応
        execMode = VIEW
        '<<2018/1/31 佐川 キャリア交換対応

        'ロットタブの初期化
        clearActualModel()

        ' 設備タブ
        btnRefresh.Enabled = False
        btnWireAdd.Enabled = False
        btnCapillaryAdd.Enabled = False
        ' 線材
        lbl0102.Text = String.Empty
        initWireParams(True)

        ' キャピラリ
        lbl0302.Text = String.Empty
        lbl0303.Text = String.Empty
        lbl0303.BackColor = NORMAL_INIT_COLOR

        'アルミ
        lblAlumi.Text = String.Empty
        lblAlumi.BackColor = NORMAL_INIT_COLOR

        ' 情報タブ
        'btnPreRackNo.Enabled = False
        'btnAfterRackNo.Enabled = False
        'btnShelfNo.Enabled = False
        'btnViewRefresh.Enabled = False

        'ADD 苗 2018/1/6 BEGIN
        '情報タブのテキストのクリア
        'txt0502.Text = String.Empty
        'txt0602.Text = String.Empty
        'txt0902.Text = String.Empty
        lbl0702.Text = String.Empty
        lbl0703.Text = String.Empty
        lbl0704.Text = String.Empty
        'ADD 苗 2018/1/6 END

        ' 着工前ラックNo
        txt0502.BackColor = NORMAL_INIT_COLOR
        lbl0502.BackColor = NORMAL_INIT_COLOR
        ' 完了ラックNo
        txt0602.BackColor = NORMAL_INIT_COLOR
        lbl0602.BackColor = NORMAL_INIT_COLOR
        ' 棚番号
        txt0902.BackColor = NORMAL_INIT_COLOR
        lbl0902.BackColor = NORMAL_INIT_COLOR
        ' フレーム数
        lbl0702.Enabled = False
        lbl0702.BackColor = NORMAL_INIT_COLOR
        lbl0703.Enabled = False
        lbl0703.BackColor = NORMAL_INIT_COLOR
        lbl0704.Enabled = False
        lbl0704.BackColor = NORMAL_INIT_COLOR

        '開始作業者No
        txtOptNoStt.Text = String.Empty
        '終了作業者No
        txtOptNoEnd.Text = String.Empty

        ' >> 20180712 佐川 ラックID入力追加
        txt0503.Text = String.Empty
        txt0504.Text = String.Empty
        txt0505.Text = String.Empty
        txt0506.Text = String.Empty
        txt0603.Text = String.Empty
        txt0604.Text = String.Empty
        txt0605.Text = String.Empty
        txt0606.Text = String.Empty
        txt0503.BackColor = NORMAL_INIT_COLOR
        txt0504.BackColor = NORMAL_INIT_COLOR
        txt0505.BackColor = NORMAL_INIT_COLOR
        txt0506.BackColor = NORMAL_INIT_COLOR
        lbl0503.BackColor = NORMAL_INIT_COLOR
        lbl0504.BackColor = NORMAL_INIT_COLOR
        lbl0505.BackColor = NORMAL_INIT_COLOR
        lbl0506.BackColor = NORMAL_INIT_COLOR
        txt0603.BackColor = NORMAL_INIT_COLOR
        txt0604.BackColor = NORMAL_INIT_COLOR
        txt0605.BackColor = NORMAL_INIT_COLOR
        txt0606.BackColor = NORMAL_INIT_COLOR
        lbl0603.BackColor = NORMAL_INIT_COLOR
        lbl0604.BackColor = NORMAL_INIT_COLOR
        lbl0605.BackColor = NORMAL_INIT_COLOR
        lbl0606.BackColor = NORMAL_INIT_COLOR
        inputCount = 0
        ' << 20180712 佐川 ラックID入力追加


        For i As Integer = 1 To 5 Step +1
            setLabel(Me.Controls.Find(String.Format("lblBeforeRack{0}", i), True), "")
            setLabel(Me.Controls.Find(String.Format("lblAfterRack{0}", i), True), "")
            setLabel(Me.Controls.Find(String.Format("lblFrameNum{0}", i), True), "")
            setLabel(Me.Controls.Find(String.Format("lblErrInnNum{0}", i), True), "")
            setLabel(Me.Controls.Find(String.Format("lblErrInnFrmNum{0}", i), True), "")
            setLabel(Me.Controls.Find(String.Format("lblEquipId{0}", i), True), "")
        Next

    End Sub

    Private Sub saveRackMng(ByVal type As String)
        Dim status = TagProcessStatus.Processing
        If type = BEGIN Then
            status = TagProcessStatus.Processing
        ElseIf type = COMPLETE Then
            status = TagProcessStatus.ManufComplete
        ElseIf type = TOTAL Then
            status = TagProcessStatus.ManufComplete
        End If
        ' >> 20180712 佐川 ラックID入力追加
        '入力したラック数分繰り返す
        '入力欄のタグの末文字の番号をループするため2～6を指定している。
        For i = 2 To 6
            Dim rackText As Control() = Me.Controls.Find(String.Format("txt050{0}", i), True)
            Dim afterRackText As Control() = Me.Controls.Find(String.Format("txt060{0}", i), True)
            Dim atmu As String = "2"
            If AutoManualMode = 0 Then
                If AUTO_MANUAL_BTN = TYPE_AUTO Then
                    atmu = "1"
                End If
            End If

            If CType(rackText(0), TextBox).Text.Length > 0 Then 'And CType(afterRackText(0), TextBox).Text.Length > 0 Then
                m_cWBRackMng.UpdateRackData(IcTag.szLotNo, status, CType(rackText(0), TextBox).Text, CType(afterRackText(0), TextBox).Text,
                            g_EQUIP_NO, txt0902.Text, atmu, lbl0703.Text, lbl0704.Text, mLocationCode)
            End If
        Next
        'm_cWBRackMng.UpdateRackData(IcTag.szLotNo, status, txt0502.Text, txt0602.Text,
        '                            g_EQUIP_NO, txt0902.Text, lbl0702.Text, lbl0703.Text, lbl0704.Text, mLocationCode) 'UPD 苗 2018/1/19 装置No.の対応
        ' << 20180712 佐川 ラックID入力追加
    End Sub

    '画面データ保存（着工時）
    Public Overrides Function SaveEquipMat(ByRef szBeginTime As DateTime) As Boolean
        saveRackMng(BEGIN)
        If saveDetail(BEGIN) < 0 Then
            Return False
        Else
            Return True
        End If
    End Function

    '画面データ保存（製造完成）
    Public Overrides Function SaveCompleteInfo(Optional ByVal status As ProcessStatus = ProcessStatus.ManufComplete) As Integer
        dtDBUpd.Clear()
        saveRackMng(COMPLETE)
        Return saveDetail(COMPLETE)
    End Function

    '画面データ保存（計上完成）
    Public Overrides Function SaveTotalInfo() As Integer
        dtDBUpd.Clear()
        saveRackMng(TOTAL)
        '>> 2018/02/14 大賀 ラック保存修正
        makeRackListView()
        '<< 2018/02/14 大賀 ラック保存修正
        Return saveDetail(TOTAL)
    End Function

    '工程明細テーブル更新処理
    Private Function saveDetail(ByVal type As String) As Integer
        setLotData()
        Dim rowsCnt As Integer = dtDBUpd.Rows.Count
        Dim addIndex As Integer = 0

        '線材 
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lbl0100.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_JYOKEN
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = 1
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CONDITION) = lbl0102.Text
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = lbl0103.Text
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MATERIAL_LOT) = lbl0104.Text
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_LIMIT_TIME) = lbl0106.Text
        addIndex += 1

        'キャピラリ
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lbl0300.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_JYOKEN
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = 1
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CONDITION) = lbl0302.Text
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = lbl0303.Text
        addIndex += 1

        'アルミ電極
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lblTitleAlumi.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_JYOKEN
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = 1
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CONDITION) = lblAlumi.Text
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = lblAlumi.Text
        addIndex += 1

        Dim rackMng = m_cWBRackMng.GetTableData(IcTag.szLotNo)
        For Each rackItem In rackMng.AsEnumerable.Select(Function(val, i) New With {val, i})
            ' 着工時
            dtDBUpd.Rows.Add()
            dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lbl0500.Tag
            dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_ELSE
            dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = rackItem.i + 1
            'dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MANAGEMENT_NO) = rackItem.val("EQUIP_ID") ' 20180315 DEL 大賀 着工中のデータをWBラック管理テーブルから取得するため不要
            dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = rackItem.val("CONSTRUCTION_RACK")
            addIndex += 1
        Next

        If type <> BEGIN Then
            For Each rackItem In rackMng.AsEnumerable.Select(Function(val, i) New With {val, i})
                ' 完工時
                dtDBUpd.Rows.Add()
                dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lbl0600.Tag
                dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_ELSE
                dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = rackItem.i + 1
                'dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MANAGEMENT_NO) = rackItem.val("EQUIP_ID") ' 20180315 DEL 大賀 着工中のデータをWBラック管理テーブルから取得するため不要
                dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = rackItem.val("COMPLETION_RACK")
                addIndex += 1
            Next
        End If

        ' 棚番号
        dtDBUpd.Rows.Add()
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lbl0900.Tag
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_ELSE
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = 1
        dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = txt0902.Text
        addIndex += 1

        'For Each rackItem In rackMng.AsEnumerable.Select(Function(val, i) New With {val, i})
        '    ' フレーム数
        '    dtDBUpd.Rows.Add()
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lbl0700.Tag
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_ELSE
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = rackItem.i
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MANAGEMENT_NO) = rackItem.val("EQUIP_ID")
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = rackItem.val("FRAME_NUM")
        '    addIndex += 1
        'Next
        ''add 苗 2018/1/6 BEGIN
        'For Each rackItem In rackMng.AsEnumerable.Select(Function(val, i) New With {val, i})
        '    '×印数
        '    dtDBUpd.Rows.Add()
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lblERRInnNum.Tag
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_ELSE
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = rackItem.i
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MANAGEMENT_NO) = rackItem.val("EQUIP_ID")
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = rackItem.val("ERR_INN_NUM")
        '    addIndex += 1
        'Next
        'For Each rackItem In rackMng.AsEnumerable.Select(Function(val, i) New With {val, i})
        '    '×枚印数
        '    dtDBUpd.Rows.Add()
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG) = lblERRInnFrmNum.Tag
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MNF_CND_TAG_FLG) = CND_TAG_FLG_ELSE
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_SEQ) = rackItem.i
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_MANAGEMENT_NO) = rackItem.val("EQUIP_ID")
        '    dtDBUpd.Rows(rowsCnt + addIndex)(DB_WORK_RESULT_PHYSICALNAME_ACTUAL_MODEL) = rackItem.val("ERR_INN_FRM_NUM")
        '    addIndex += 1
        'Next
        'add 苗 2018/1/6 END
        Return m_cEquipMat.SaveDetail(lotNo, IcTag.szProcsCD, type,
                                      m_szTable, dtDBUpd, m_dtHeader,
                                      m_cIdohyo.EquipInfo.szEquipNo, serverTime)
    End Function

    '計上完成時チェック処理
    Public Overrides Function EndCheck() As Boolean

        ' 設備タブのチェック
        '>>2018/2/20 大賀 No79 計上完成時にBSiteチェック実施
        '' 線材 製造条件
        'If String.IsNullOrEmpty(lbl0103.Text) Then
        '    MsgBox(getMsgStr("MSG00101", lbl0100.Text))
        '    Return False
        'ElseIf lbl0103.Text <> lbl0102.Text Then
        '    MsgBox(getMsgStr("MSG00021", lbl0100.Text))
        '    lbl0103.BackColor = ERROR_INIT_COLOR
        '    Return False
        'End If
        '' 使用期限
        'If String.IsNullOrEmpty(lbl0106.Text) Then
        '    MsgBox(getMsgStr("MSG00101", lbl0100.Text))
        '    Return False
        'ElseIf Not checkExpirationDate(lbl0106, lbl0100.Text, SCORE_NUM.WIRE) Then
        '    Return False
        'End If

        '' キャピラリ 製造条件
        'If String.IsNullOrEmpty(lbl0303.Text) Then
        '    MsgBox(getMsgStr("MSG00101", lbl0300.Text))
        '    Return False
        'ElseIf lbl0303.Text <> lbl0302.Text Then
        '    MsgBox(getMsgStr("MSG00021", lbl0300.Text))
        '    lbl0303.BackColor = ERROR_INIT_COLOR
        '    Return False
        'End If
        If Not getBsiteData() Then
            Return False
        End If
        '<<2018/2/20 大賀 No79 計上完成時にBSiteチェック実施

        ' 情報タブ
        ' 完了ラックNoの空白チェック
        If Not checkBlank(txt0602.Text, lbl0600.Text) Then
            checkColor(txt0602, False, lbl0602.Name)
            Return False
        End If
        ' 同一ロットで重複しているか判定
        If Not m_cWBRackMng.IsCheckCompRack(IcTag.szLotNo, txt0602.Text, g_EQUIP_NO, TagProcessStatus.Processing) Then 'UPD 苗 2018/1/19 装置No.の対応
            setCheckInfo(getMsgStr("MSG10005", lbl0600.Text))
            checkColor(txt0602, False, lbl0602.Name)
            Return False
        End If
        '棚番号
        txt0902.Text = m_cWBRackMng.GetShelfAdrFC(IcTag.szLotNo)
        ' 棚番号重複チェック
        'If Not m_cWBRackMng.IsCheckShelfNo(IcTag.szLotNo, txt0902.Text) Then
        '    setCheckInfo(getMsgStr("MSG10006", lbl0900.Text))
        '    checkColor(txt0902, False, lbl0902.Name)
        '    Return False
        'End If
        'UPD 苗 2018/1/13 BEGIN
        '×印枚数のチェックと廃棄フレーム枚数のチェック
        If chkCrossFrame() = False Then
            Return False
        End If
        ''廃棄フレーム枚数のチェック
        'lblLostframe = lbl0702
        'strLostFrame = lbl0700.Text
        'If chkCrossFrame() = False Then
        '    Return False
        'End If
        ''×印枚数のチェック
        'lblLostframe = lbl0704
        'strLostFrame = lblERRInnFrmNum.Text
        'If chkCrossFrame() = False Then
        '    Return False
        'End If

        'Call chkCrossFrame()
        'UPD 苗 2018/1/13 END
        '>>20180329 大賀 No125 S42で最後の完成を実施しても臨時完成となる場合がある
        DBacs.BeginTransaction()
        ' Multi計上に必要なデータを設定
        'mMultiExecCheck = m_cWBRackMng.IsCompleteStatus(IcTag.szLotNo, TagProcessStatus.ManufComplete, txt0502.Text)
        ' >> 20180712 佐川 ラックID入力追加
        '入力ラックリスト作成
        Dim inputRackList As New List(Of String)
        If Not txt0502.Text.Equals("") Then
            inputRackList.Add(txt0502.Text)
        End If
        If Not txt0503.Text.Equals("") Then
            inputRackList.Add(txt0503.Text)
        End If
        If Not txt0504.Text.Equals("") Then
            inputRackList.Add(txt0504.Text)
        End If
        If Not txt0505.Text.Equals("") Then
            inputRackList.Add(txt0505.Text)
        End If

        'Dim IsSend = m_cWBRackMng.CheckCompleteStatus(IcTag.szLotNo, txt0502.Text)
        Dim IsSend = m_cWBRackMng.CheckCompleteStatus(IcTag.szLotNo, inputRackList)
        ' >> 20180712 佐川 ラックID入力追加
        If IsSend.Equals(SendStatus.SENDING) Then
            ' bSite通信中のラックがあるので処理を中断する
            setCheckInfo(getMsgStr("MSG10036"))
            DBacs.CommitTransaction()
            Return False
        ElseIf IsSend.Equals(SendStatus.NG) Then
            mMultiExecCheck = False
        Else
            mMultiExecCheck = True
        End If

        ' >> 20180712 佐川 ラックID入力追加
        '全件登録の場合は計上完成ステータスに変更する。
        If inputCount = preRackNoList.Count Then
            mMultiExecCheck = True
        End If
        ' << 20180712 佐川 ラックID入力追加

        mMultiTotalFrame = m_cWBRackMng.getTotalFrame(IcTag.szLotNo)
        ' 送信中に更新する
        'DEL Miaojf 2020/07/17
        'm_cWBRackMng.UpdateRackData(IcTag.szLotNo, WB_BSITE_SENDING, txt0502.Text, txt0602.Text,
        '                            g_EQUIP_NO, txt0902.Text, lbl0702.Text, lbl0703.Text, lbl0704.Text, mLocationCode)
        DBacs.CommitTransaction()
        '<<20180329 大賀 No125 S42で最後の完成を実施しても臨時完成となる場合がある


        '>>2018/1/31 佐川 キャリア交換対応
        If mMultiExecCheck Then
            execMode = TOTAL
        Else
            execMode = VIEW
        End If
        '<<2018/1/31 佐川 キャリア交換対応
        tmpInRackNo = txt0502.Text
        tmpOutRackNo = txt0602.Text
        Return True
    End Function
    Overrides Sub setTextDataEmpty(textData As TextBox)
        If m_ProcessStatus <> ProcessStatus.TempProcessing And m_ProcessStatus <> ProcessStatus.TagSet Then
            textData.Text = String.Empty
        End If
    End Sub
    ' 20180315 大賀 ロストフォーカスでのエラーチェックをやめるため、WB用のKeyPressイベントに置き換え
    Private Sub txtData_KeyPressWB(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)

        '頭に付いている'%'を消す
        Static Dim fIsPercentInput As Boolean = False
        If e.KeyChar = CChar("%") OrElse e.KeyChar = CChar("％") Then
            fIsPercentInput = True
            e.Handled = True
            Exit Sub
        End If
        If fIsPercentInput Then
            fIsPercentInput = False
            e.Handled = True
            Exit Sub
        End If

        If e.KeyChar = vbCr Then
            If txtWB_ErrorCheck(sender) Then
                Dim txtData As TextBox = CType(sender, TextBox)
                txtData.Text = txtData.Text.ToUpper 'Add 苗 2018/4/10
                txtData.Enabled = False
                tmpRackNo = txtData.Text

                If AutoManualMode = 0 And AUTO_MANUAL_BTN = TYPE_AUTO Then
                    'Add 苗 2019/11/24 Begin
                    If txtData.Tag.ToString.Equals("05") Or txtData.Tag.ToString.Equals("06") Then
                        Dim tmpLotNo As String = ""
                        If AUTO_MANUAL_BTN = TYPE_AUTO Then
                            If txtData.Tag.ToString.Equals("05") Then
                                tmpLotNo = getLotNoByRack(txt0502.Text)
                                'add MIAOJF 20200912 VER.80
                                If txt0602.Text <> "" Then
                                    txt0602.Text = ""
                                End If
                            End If

                        Else
                            If txt0502.Text <> "" And txt0602.Text <> "" Then
                                If txtWB_ErrorCheck(txt0502) AndAlso txtWB_ErrorCheck(txt0602) Then
                                    tmpLotNo = getLotNoByRack(txt0502.Text)
                                End If
                            End If
                        End If
                        'If txtLotNo.Text = "" Or (tmpLotNo <> "" And txtLotNo.Text <> tmpLotNo) Then
                        If tmpLotNo = "" And txtLotNo.Text <> "" Then
                            If Not m_cWBRackMng.chkRackStatus(IcTag.szLotNo, TagProcessStatus.Ready, txtData.Text, g_EQUIP_NO) Then
                                LC_SEND_FLG = False
                            End If

                            txtLotNo_KeyPress(txtLotNo, New KeyPressEventArgs(vbCr))
                            LC_SEND_FLG = True
                            Dim lblItem As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}00", txtData.Tag.ToString), False)(0)

                            ' >> 20180712 佐川 ラックID入力追加
                            Dim lblData As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}", txtData.Name.ToString.Substring(3, 4)), False)(0)
                            txtData.BackColor = ENTERED_INIT_COLOR
                            lblData.BackColor = ENTERED_INIT_COLOR
                            m_iScore(SCORE_NUM.PRE_RACK_NO) = PASS_SCORE_CHECKED
                            Exit Sub
                        End If
                        If tmpLotNo = txtLotNo.Text And m_cWBRackMng.chkRackStatus(IcTag.szLotNo, TagProcessStatus.Ready, txtData.Text, g_EQUIP_NO) = False Then Exit Sub
                        txtLotNo.Text = tmpLotNo
                        If txtLotNo.Text.Trim() <> "" Then
                            If Not m_cWBRackMng.chkRackStatus(IcTag.szLotNo, TagProcessStatus.Ready, txtData.Text, g_EQUIP_NO) Then
                                LC_SEND_FLG = False
                            End If
                            txtLotNo_KeyPress(txtLotNo, New KeyPressEventArgs(vbCr))
                            LC_SEND_FLG = True
                            m_iScore(SCORE_NUM.PRE_RACK_NO) = PASS_SCORE_CHECKED
                            m_iScore(SCORE_NUM.AFTER_RACK_NO) = PASS_SCORE_CHECKED
                            'If txtWB_ErrorCheck(sender) = False Then HideCommandWaiting()
                            Call setCompleteCnt()
                        End If
                        ' End If
                    End If
                    'Add 苗 2019/11/24 End
                Else

                    ' >> 20180712 佐川 ラックID入力追加
                    If Not IcTag.Status = TagProcessStatus.Processing Then
                        '着工時ラックNoか完了時ラックNoの場合は、フォーカス移動を行う。
                        If txtData.Tag.ToString.Equals("05") Or txtData.Tag.ToString.Equals("06") Then
                            'フォーカス変更
                            For i = 2 To 6
                                If txtData.Name = String.Format("txt{0}0{1}", txtData.Tag.ToString, i) Then
                                    Dim lblData As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}0{1}", txtData.Tag.ToString, i), False)(0)

                                    If Not txtData.Text.Equals("") Then
                                        txtData.BackColor = ENTERED_INIT_COLOR
                                        lblData.BackColor = ENTERED_INIT_COLOR
                                        txtData.Enabled = False
                                        'Add 苗 2018/9/26 BEGIN

                                        rackCount += 1
                                    End If

                                    If rackCount = 2 Then
                                        If txtData.Tag.ToString.Equals("05") Then
                                            rackCount = 0
                                            txt0602.Focus()
                                            txt0602.Focus()
                                            txt0602.SelectAll()
                                            txt0602.BackColor = Color.Cyan
                                            lbl0602.BackColor = Color.Cyan
                                        End If
                                        If txtData.Tag.ToString.Equals("06") Then
                                            rackCount = 0
                                            txt0902.Focus()
                                            txt0902.Focus()
                                            txt0902.SelectAll()
                                            txt0902.BackColor = Color.Cyan
                                            lbl0902.BackColor = Color.Cyan
                                        End If
                                        Exit Sub
                                    End If
                                    'Add 苗 2018/9/26 END

                                    '5列目以下だったらフォーカスを移す
                                    If i < 6 Then
                                        Dim nextLbl As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}0{1}", txtData.Tag.ToString, i + 1), False)(0)
                                        Dim nextTxtData As TextBox = txtData.Parent.Controls.Find(String.Format("txt{0}0{1}", txtData.Tag.ToString, i + 1), False)(0)

                                        nextTxtData.Enabled = True
                                        nextTxtData.Focus()
                                        nextTxtData.SelectAll()
                                        nextTxtData.BackColor = Color.Cyan
                                        nextLbl.BackColor = Color.Cyan
                                    End If
                                End If
                            Next
                        End If
                    End If
                    ' << 20180712 佐川 ラックID入力追加


                End If

            End If
        End If
    End Sub



    ' 20180315 大賀 ロストフォーカス→入力チェックに変更
    Private Function txtWB_ErrorCheck(ByVal sender As Object) As Boolean
        If txtLotNo.Text = "" Then Return True
        Dim txtData As TextBox = CType(sender, TextBox)
        txtData.Text = txtData.Text.ToUpper 'Add 苗 2018/4/10
        Dim lblItem As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}00", txtData.Tag.ToString), False)(0)

        ' >> 20180712 佐川 ラックID入力追加
        Dim lblData As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}", txtData.Name.ToString.Substring(3, 4)), False)(0)
        'Dim lblData As Label = txtData.Parent.Controls.Find(String.Format("lbl{0}02", txtData.Tag.ToString), False)(0)
        ' << 20180712 佐川 ラックID入力追加

        Dim idx As Integer
        If txtData.Tag.ToString.Equals("05") Then
            idx = SCORE_NUM.PRE_RACK_NO
        ElseIf txtData.Tag.ToString.Equals("06") Then
            idx = SCORE_NUM.AFTER_RACK_NO
        Else
            'idx = SCORE_NUM.SHELF_NO
        End If
        'm_iScore(SCORE_NUM.SHELF_NO) = PASS_SCORE_CHECKED
        ' >> 20180712 佐川 ラックID入力追加
        '着工時ラックNo1,完了時ラックNo1,棚番号のみ空白チェックを行う
        If txtData.Name.Equals("txt0502") Or txtData.Name.Equals("txt0602") Then
            If Not checkBlank(txtData.Text, lblItem.Text.Replace(vbCrLf, "")) Then
                setError(sender, txtData, lblData, idx)
                Return False
            End If
        Else
            If txtData.Text.Equals("") Then
                m_iScore(idx) = PASS_SCORE_CHECKED
                If idx = SCORE_NUM.PRE_RACK_NO Then
                    txtData.BackColor = BARCODE_INIT_COLOR
                    lblData.BackColor = BARCODE_INIT_COLOR
                Else
                    txtData.BackColor = TENKEY_INIT_COLOR
                    lblData.BackColor = TENKEY_INIT_COLOR
                End If
                '前工程ラック数と完了ラック数の一致チェック
                If isCheckInputRack() Then
                    m_iScore(4) = PASS_SCORE_CHECKED
                Else
                    m_iScore(4) = PASS_SCORE_WAIT_CHECK
                End If
                Return True
            End If
        End If
        ' << 20180712 佐川 ラックID入力追加


        ' 前工程一致チェック
        If idx = SCORE_NUM.PRE_RACK_NO Then
            '着工前ラックNoの場合
            Dim rack = preRackNoList.SingleOrDefault(Function(x) x.Equals(txtData.Text))
            If rack Is Nothing Then
                MsgBox(getMsgStr("MSG00052", lblItem.Text))
                setError(sender, txtData, lblData, idx)
                Return False
            End If
            ' 作業済みラックか判定
            If Not m_cWBRackMng.IsCheckRackStatus(IcTag.szLotNo, TagProcessStatus.Ready, txtData.Text, g_EQUIP_NO) Then 'UPD 苗 2018/1/19 装置No.の対応
                MsgBox(getMsgStr("MSG10004", lblItem.Text))
                setError(sender, txtData, lblData, idx)
                Return False
            End If
            '>>20180313 大賀 搬送容器桁数チェックを共通化
            ' ラックNoの桁数チェック
            If Not isCheckCaseLength(txtData, RACK_CASE_NO_LENGTH, lblData) Then
                m_iScore(idx) = PASS_SCORE_WAIT_CHECK
                Return False
            End If
            '<<20180313 大賀 搬送容器桁数チェックを共通化
            ' >> 20180712 佐川 ラックID入力追加
            'ラック重複チェック
            If Not isDiplicateCase(sender) Then
                MsgBox(getMsgStr("MSG00064", lblItem.Text))
                m_iScore(idx) = PASS_SCORE_WAIT_CHECK
                setError(sender, txtData, lblData, idx)
                Return False
            End If
            ' >> 20180712 佐川 ラックID入力追加
        ElseIf idx = SCORE_NUM.AFTER_RACK_NO Then
            ' 同一ロットで重複しているか判定
            'If Not m_cWBRackMng.IsCheckCompRack(IcTag.szLotNo, txtData.Text, g_EQUIP_NO, TagProcessStatus.Ready) Then 'UPD 苗 2018/1/19 装置No.の対応
            '    MsgBox(getMsgStr("MSG10005", lblItem.Text))
            '    setError(sender, txtData, lblData, idx)
            '    Return False
            'End If

            If Not txtData.Text.Equals("") Then
                '>>2018/2/1 佐川 RSB確認結果一覧No64
                '前工程ラックNoと一致している場合はエラー
                'If txt0502.Text.Equals(txt0602.Text) Then
                '    MsgBox(getMsgStr("MSG10018", txtData.Text))
                '    setError(sender, txtData, lblData, idx)
                '    Return False
                'End If
                '<<2018/2/1 佐川 RSB確認結果一覧No64
                ' >> 20180712 佐川 ラックID入力追加
                For i = 2 To 6
                    '前工程ラックNoの入力数確認
                    Dim rackText As Control() = Me.Controls.Find(String.Format("txt050{0}", i), True)
                    If CType(rackText(0), TextBox).Text.Length > 0 Then
                        If CType(rackText(0), TextBox).Text.Equals(txtData.Text) Then
                            MsgBox(getMsgStr("MSG10018", txtData.Text))
                            setError(sender, txtData, lblData, idx)
                            Return False
                        End If
                    End If
                Next
                'ラック重複チェック
                If Not isDiplicateCase(sender) Then
                    MsgBox(getMsgStr("MSG00064", lblItem.Text))
                    m_iScore(idx) = PASS_SCORE_WAIT_CHECK
                    setError(sender, txtData, lblData, idx)
                    Return False
                End If
                ' << 20180712 佐川 ラックID入力追加
            End If

            '>>20180313 大賀 搬送容器桁数チェックを共通化
            ' ラックNoの桁数チェック
            If Not isCheckCaseLength(txtData, RACK_CASE_NO_LENGTH, lblData) Then
                m_iScore(idx) = PASS_SCORE_WAIT_CHECK
                Return False
            End If
            '<<20180313 大賀 搬送容器桁数チェックを共通化

            'ElseIf idx = SCORE_NUM.SHELF_NO Then
            '    ' 同一ロットで重複しているか判定
            '    If Not m_cWBRackMng.IsCheckShelfNo(IcTag.szLotNo, txtData.Text) Then
            '        MsgBox(getMsgStr("MSG10006", lblItem.Text))
            '        setError(sender, txtData, lblData, idx)
            '        Return False
            '    End If
        End If

        ' >> 20180712 佐川 ラックID入力追加
        '前工程ラック数と完了ラック数の一致チェック
        'If isCheckInputRack() Then
        '    m_iScore(4) = PASS_SCORE_CHECKED
        'Else
        '    m_iScore(4) = PASS_SCORE_WAIT_CHECK
        'End If
        ' << 20180712 佐川 ラックID入力追加

        'エラーがない場合
        txtData.BackColor = ENTERED_INIT_COLOR
        lblData.BackColor = ENTERED_INIT_COLOR
        m_iScore(idx) = PASS_SCORE_CHECKED
        If idx = SCORE_NUM.AFTER_RACK_NO Then
            m_iScore(4) = PASS_SCORE_CHECKED
        End If
        CheckCollScore()
        Return True
    End Function

    ' エラー時の設定を共通化
    Private Sub setError(sender As Object, txtData As TextBox, lblData As Label, idx As Integer)
        checkColor(sender, False, lblData.Name)
        m_iScore(idx) = PASS_SCORE_WAIT_CHECK
        txtData.Enabled = True  'ADD 苗 2018/2/9
        txtData.Focus() 'ADD 苗 2018/2/1
        txtData.SelectAll() 'ADD 苗 2018/2/1
    End Sub

    Public Overrides Sub ConfScreenItem()
        If txtLotNo.TextLength > 0 Then

            'Call resetStatus() 'ADD 苗 2018/1/6

            If m_ProcessStatus = ProcessStatus.TempProcessing Then
                IcTag.Status = TagProcessStatus.Processing
                'convertProcessStatus()
            ElseIf m_ProcessStatus = ProcessStatus.TempComplete Then
                m_ProcessStatus = ProcessStatus.Ready

                'IcTag.Status = TagProcessStatus.Ready
                ''convertProcessStatus()

            End If
            If AutoManualMode = 0 And AUTO_MANUAL_BTN = TYPE_AUTO Then
            Else
                If IcTag.Status = TagProcessStatus.Ready Then
                    '着工待ち
                    ' 設備タブ
                    btnRefresh.Enabled = True
                    btnWireAdd.Enabled = True
                    btnCapillaryAdd.Enabled = True

                    ' 情報タブ
                    btnPreRackNo.Enabled = True
                    btnAfterRackNo.Enabled = True
                    btnShelfNo.Enabled = True
                    btnViewRefresh.Enabled = True

                    ' 着工前ラックNo
                    txt0502.Enabled = True
                    'txt0502.Text = String.Empty
                    txt0502.BackColor = BARCODE_INIT_COLOR
                    lbl0502.BackColor = BARCODE_INIT_COLOR
                    ' 完了ラックNo
                    txt0602.Enabled = True
                    'txt0602.Text = String.Empty
                    txt0602.BackColor = TENKEY_INIT_COLOR
                    lbl0602.BackColor = TENKEY_INIT_COLOR
                    ' 棚番号
                    txt0902.BackColor = TENKEY_INIT_COLOR
                    lbl0902.BackColor = TENKEY_INIT_COLOR
                    ' フレーム数
                    lbl0702.Enabled = False
                    lbl0702.BackColor = NORMAL_INIT_COLOR
                    lbl0703.Enabled = False
                    lbl0703.BackColor = NORMAL_INIT_COLOR
                    lbl0704.Enabled = False
                    lbl0704.BackColor = NORMAL_INIT_COLOR

                    ' >> 20180712 佐川 ラックID入力追加
                    ' 着工前ラックNo
                    txt0503.Enabled = False
                    txt0504.Enabled = False
                    txt0505.Enabled = False
                    txt0506.Enabled = False
                    txt0503.BackColor = BARCODE_INIT_COLOR
                    txt0504.BackColor = BARCODE_INIT_COLOR
                    txt0505.BackColor = BARCODE_INIT_COLOR
                    txt0506.BackColor = BARCODE_INIT_COLOR
                    lbl0503.BackColor = BARCODE_INIT_COLOR
                    lbl0504.BackColor = BARCODE_INIT_COLOR
                    lbl0505.BackColor = BARCODE_INIT_COLOR
                    lbl0506.BackColor = BARCODE_INIT_COLOR
                    ' 完了ラックNo
                    txt0603.Enabled = False
                    txt0604.Enabled = False
                    txt0605.Enabled = False
                    txt0606.Enabled = False
                    txt0603.BackColor = TENKEY_INIT_COLOR
                    txt0604.BackColor = TENKEY_INIT_COLOR
                    txt0605.BackColor = TENKEY_INIT_COLOR
                    txt0606.BackColor = TENKEY_INIT_COLOR
                    lbl0603.BackColor = TENKEY_INIT_COLOR
                    lbl0604.BackColor = TENKEY_INIT_COLOR
                    lbl0605.BackColor = TENKEY_INIT_COLOR
                    lbl0606.BackColor = TENKEY_INIT_COLOR
                    ' << 20180712 佐川 ラックID入力追加

                ElseIf IcTag.Status = TagProcessStatus.Processing Then
                    '着工中
                    ' 設備タブ
                    btnRefresh.Enabled = True
                    btnWireAdd.Enabled = True
                    btnCapillaryAdd.Enabled = True

                    ' 情報タブ
                    'btnPreRackNo.Enabled = False
                    'btnAfterRackNo.Enabled = False
                    'btnShelfNo.Enabled = False
                    'btnViewRefresh.Enabled = True

                    ' 着工前ラックNo
                    txt0502.BackColor = NORMAL_INIT_COLOR
                    lbl0502.BackColor = NORMAL_INIT_COLOR
                    ' 完了ラックNo
                    txt0602.BackColor = NORMAL_INIT_COLOR
                    lbl0602.BackColor = NORMAL_INIT_COLOR
                    ' 棚番号
                    txt0902.BackColor = NORMAL_INIT_COLOR
                    lbl0902.BackColor = NORMAL_INIT_COLOR
                    ' フレーム数
                    lbl0702.Enabled = True
                    lbl0702.BackColor = TENKEY_INIT_COLOR
                    lbl0703.Enabled = True
                    lbl0703.BackColor = TENKEY_INIT_COLOR
                    lbl0704.Enabled = True
                    lbl0704.BackColor = TENKEY_INIT_COLOR

                    ' >> 20180712 佐川 ラックID入力追加
                    ' 着工前ラックNo
                    txt0503.BackColor = NORMAL_INIT_COLOR
                    txt0504.BackColor = NORMAL_INIT_COLOR
                    txt0505.BackColor = NORMAL_INIT_COLOR
                    txt0506.BackColor = NORMAL_INIT_COLOR
                    lbl0503.BackColor = NORMAL_INIT_COLOR
                    lbl0504.BackColor = NORMAL_INIT_COLOR
                    lbl0505.BackColor = NORMAL_INIT_COLOR
                    lbl0506.BackColor = NORMAL_INIT_COLOR
                    ' 完了ラックNo
                    txt0603.BackColor = NORMAL_INIT_COLOR
                    txt0604.BackColor = NORMAL_INIT_COLOR
                    txt0605.BackColor = NORMAL_INIT_COLOR
                    txt0606.BackColor = NORMAL_INIT_COLOR
                    lbl0603.BackColor = NORMAL_INIT_COLOR
                    lbl0604.BackColor = NORMAL_INIT_COLOR
                    lbl0605.BackColor = NORMAL_INIT_COLOR
                    lbl0606.BackColor = NORMAL_INIT_COLOR
                    ' << 20180712 佐川 ラックID入力追加


                ElseIf IcTag.Status = TagProcessStatus.ManufComplete Then
                    '着工待ち
                    ' 設備タブ
                    btnRefresh.Enabled = True
                    btnWireAdd.Enabled = True
                    btnCapillaryAdd.Enabled = True

                    ' 情報タブ
                    'btnPreRackNo.Enabled = True
                    'btnAfterRackNo.Enabled = True
                    'btnShelfNo.Enabled = True
                    'btnViewRefresh.Enabled = True

                    ' 着工前ラックNo


                    txt0502.Enabled = True
                    'txt0502.Text = String.Empty
                    m_iScore(SCORE_NUM.PRE_RACK_NO) = PASS_SCORE_WAIT_CHECK
                    txt0502.BackColor = BARCODE_INIT_COLOR
                    lbl0502.BackColor = BARCODE_INIT_COLOR

                    ' 完了ラックNo
                    txt0602.Enabled = True
                    'txt0602.Text = String.Empty
                    m_iScore(SCORE_NUM.AFTER_RACK_NO) = PASS_SCORE_WAIT_CHECK
                    txt0602.BackColor = TENKEY_INIT_COLOR
                    lbl0602.BackColor = TENKEY_INIT_COLOR
                    ' 棚番号
                    txt0902.BackColor = TENKEY_INIT_COLOR
                    lbl0902.BackColor = TENKEY_INIT_COLOR

                    ' フレーム数
                    lbl0702.Text = String.Empty
                    lbl0703.Text = String.Empty
                    lbl0704.Text = String.Empty

                    lbl0702.Enabled = False
                    lbl0702.BackColor = NORMAL_INIT_COLOR
                    lbl0703.Enabled = False
                    lbl0703.BackColor = NORMAL_INIT_COLOR
                    lbl0704.Enabled = False
                    lbl0704.BackColor = NORMAL_INIT_COLOR
                    '棚番号
                    txt0902.Text = m_cWBRackMng.GetShelfAdrFC(IcTag.szLotNo)
                    ' >> 20180712 佐川 ラックID入力追加
                    txt0503.Enabled = True
                    txt0504.Enabled = True
                    txt0505.Enabled = True
                    txt0506.Enabled = True
                    txt0503.Text = String.Empty
                    txt0504.Text = String.Empty
                    txt0505.Text = String.Empty
                    txt0506.Text = String.Empty
                    txt0503.BackColor = BARCODE_INIT_COLOR
                    txt0504.BackColor = BARCODE_INIT_COLOR
                    txt0505.BackColor = BARCODE_INIT_COLOR
                    txt0506.BackColor = BARCODE_INIT_COLOR
                    lbl0503.BackColor = BARCODE_INIT_COLOR
                    lbl0504.BackColor = BARCODE_INIT_COLOR
                    lbl0505.BackColor = BARCODE_INIT_COLOR
                    lbl0506.BackColor = BARCODE_INIT_COLOR
                    txt0603.Enabled = True
                    txt0604.Enabled = True
                    txt0605.Enabled = True
                    txt0606.Enabled = True
                    txt0603.Text = String.Empty
                    txt0604.Text = String.Empty
                    txt0605.Text = String.Empty
                    txt0606.Text = String.Empty
                    txt0603.BackColor = TENKEY_INIT_COLOR
                    txt0604.BackColor = TENKEY_INIT_COLOR
                    txt0605.BackColor = TENKEY_INIT_COLOR
                    txt0606.BackColor = TENKEY_INIT_COLOR
                    lbl0603.BackColor = TENKEY_INIT_COLOR
                    lbl0604.BackColor = TENKEY_INIT_COLOR
                    lbl0605.BackColor = TENKEY_INIT_COLOR
                    lbl0606.BackColor = TENKEY_INIT_COLOR
                    ' << 20180712 佐川 ラックID入力追加

                    If Not String.IsNullOrEmpty(txt0902.Text) Then
                        ' 入力済みに設定
                        txt0902.BackColor = ENTERED_INIT_COLOR
                        lbl0902.BackColor = ENTERED_INIT_COLOR
                        txt0902.Enabled = False '苗 2018/1/6
                        'm_iScore(SCORE_NUM.SHELF_NO) = PASS_SCORE_CHECKED
                    Else '苗 2018/1/6
                        'm_iScore(SCORE_NUM.SHELF_NO) = PASS_SCORE_CHECKED 'ADD 苗 2019/12/4
                        txt0902.Enabled = True '苗 2018/1/6
                    End If
                    '2020/8/17 ????
                    IcTag.Status = TagProcessStatus.Ready
                    m_ProcessStatus = ProcessStatus.TagSet
                Else
                    '不正
                    MsgBox(getMsgStr("MSG00025"))
                End If
            End If
            ' 一覧更新
            makeRackListView()
        End If

        btnManufComp.Enabled = False '製造完成ボタン不可用
        'btnErrInput.Enabled = False '不良項目入力ボタン不可用 'UPD 苗 2018/1/31 不良項目入力ボタンを使用可にする

        'DEL 苗 2018/1/11 BEGIN
        '画面の廃棄フレーム枚数、X印数、X印枚数
        'Dim SUM_ERR_INN_NUM As Integer = 0
        'Dim SUM_ERR_INN_FRM_NUM As Integer = 0
        'Dim SUM_FRAME_NUM As Integer = 0


        'If m_cWBRackMng.getSum(lotNo, SUM_ERR_INN_NUM, SUM_ERR_INN_FRM_NUM, SUM_FRAME_NUM) Then
        '    lblCrossCnt.Text =  SUM_ERR_INN_NUM 'X印数
        '    lblCrossPcbCnt.Text =  SUM_ERR_INN_FRM_NUM 'X印枚数
        '    'フレーム枚数=廃棄フレーム枚数の合計
        '    lblPcbCnt.Text =  SUM_FRAME_NUM
        'End If
        'DEL 苗 2018/1/11 END
    End Sub

    'キャピラリ B-Siteチェック
    Private Function CheckCapillary(outMachine As InSiteWebService.OutViewMachine) As Boolean
        '値初期化
        lbl0303.Text = String.Empty
        lbl0303.BackColor = NORMAL_INIT_COLOR

        If String.IsNullOrEmpty(lbl0302.Text) Then
            ' 製造条件が空の場合はチェックを行わないで、着工チェックフラグを立てる
            m_iScore(SCORE_NUM.CAPILLARY) = PASS_SCORE_CHECKED
            Return True
        End If

        ' b-Site取得エラーチェック
        Dim getDataList = outMachine.MachineInf.MaterialInf.Where(Function(x) x.Category.Trim = BSITE_CATEGORY_CAPILLARY And x.Type IsNot Nothing).ToList
        If getDataList.Count = 0 Then
            MsgBox(getMsgStr("MSG00101", lbl0300.Text))
            lbl0303.BackColor = ERROR_INIT_COLOR
            m_iScore(SCORE_NUM.CAPILLARY) = PASS_SCORE_WAIT_CHECK
            Return False
        End If

        '製造条件でリストを検索
        Dim getData = getDataList.FirstOrDefault(Function(x) x.Type = lbl0302.Text.Split(DEF_SLASH)(0).Trim)
        If getData Is Nothing Then
            MsgBox(getMsgStr("MSG10030", lbl0300.Text, makeViewMachineTypeString(getDataList)))
            lbl0303.BackColor = ERROR_INIT_COLOR
            lbl0303.Text = String.Empty
            m_iScore(SCORE_NUM.CAPILLARY) = PASS_SCORE_WAIT_CHECK
            Return False
        End If
        lbl0303.Text = getData.Type.Trim
        m_iScore(SCORE_NUM.CAPILLARY) = PASS_SCORE_CHECKED

        Return True
    End Function

    'B-Siteチェック
    Private Function getBsiteData() As Boolean
        'B-Site ViewMachineService
        Dim clientProcCd = GetBsiteClientString()
        Dim outMachine = getViewLotService(clientProcCd)

        '取得できないorエラー応答の場合はNG
        If outMachine.Header Is Nothing OrElse outMachine.Header.Status = STS_ERROR Then
            MsgBox(getMsgStr("MSG00101", lbl0100.Text))
            lbl0103.BackColor = ERROR_INIT_COLOR
            lbl0103.Text = String.Empty
            m_iScore(SCORE_NUM.WIRE) = PASS_SCORE_WAIT_CHECK
            Return False
        End If
        '線材チェック処理
        If Not checkWire(outMachine) Then
            Return False
        End If
        'キャピラリチェック処理
        If Not CheckCapillary(outMachine) Then
            Return False
        End If
        CheckCollScore()
        Return True
    End Function


    '着工中になったらタイマーをスタートさせる
    Public Overrides Sub JiSuccess()
        MyBase.JiSuccess()
        'lblPcbCnt.Text = String.Empty 'ADD 苗 2018/1/13 
        WIRETimer.Enabled = True

    End Sub

    ' 使用期限のタイマー処理
    Private Sub WIRETimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles WIRETimer.Tick
        WIRETimer.Enabled = False
        If Not IcTag.Status <> TagProcessStatus.Ready Then
            ' 着工中でない場合，タイマーをストップする
            Exit Sub
        End If

        ' ペースト1行目
        If Not String.IsNullOrEmpty(lbl0106.Text) Then
            If Not checkExpirationDate(lbl0106, lbl0100.Text, SCORE_NUM.WIRE) Then
                Exit Sub
            End If
        End If
        'DEL 苗 2018/1/30 BEGIN 材料１だけの対応
        '' ペースト2行目
        'If Not String.IsNullOrEmpty(lbl0206.Text) Then
        '    If Not checkExpirationDate(lbl0206, 1) Then
        '        Exit Sub
        '    End If
        'End If
        'DEL 苗 2018/1/30 END 材料１だけの対応
        WIRETimer.Enabled = True
    End Sub
    ' 使用期限のチェックを行う
    Private Function checkExpirationDate(labelDate As Label, title As String, index As Integer) As Boolean
        '現在の日付を取得する
        Dim dtNow As DateTime = m_cData.GetServerTime()
        Dim dt As DateTime

        '日付に変換できるかどうか
        If DateTime.TryParse(labelDate.Text, dt) Then
            dt.AddMinutes(-20) 'ADD MIAO　20191227 UPD 材料期限-20分をオーバーしたらエラーメッセージを表示する

            '変換出る場合、現在の日付と比較する
            If DateTime.Compare(dt, dtNow) < 0 OrElse DateTime.Compare(dt, dtNow) = 0 Then
                ' 使用期限 <= 現在時刻の場合，エラーを表示する
                labelDate.BackColor = ERROR_INIT_COLOR
                MsgBox(getMsgStr("MSG00049", title))
                m_iScore(index) = PASS_SCORE_WAIT_CHECK
                Return False
            End If
        Else
            labelDate.BackColor = ERROR_INIT_COLOR
            MsgBox(getMsgStr("MSG00048", title))
            m_iScore(index) = PASS_SCORE_WAIT_CHECK
            Return False
        End If
        Return True
    End Function

    ' 線材の表示初期化
    Private Sub initWireParams(isStringClear As Boolean)
        If isStringClear Then
            '入力文字列のクリア
            lbl0103.Text = String.Empty
            lbl0104.Text = String.Empty
            lbl0106.Text = String.Empty
        End If
        lbl0102.BackColor = NORMAL_INIT_COLOR
        lbl0103.BackColor = NORMAL_INIT_COLOR
        lbl0104.BackColor = NORMAL_INIT_COLOR
        lbl0106.BackColor = NORMAL_INIT_COLOR
    End Sub

    '線材 B-Siteチェック
    Private Function checkWire(outMachine As InSiteWebService.OutViewMachine) As Boolean
        initWireParams(True)

        If String.IsNullOrEmpty(lbl0102.Text) Then
            ' 製造条件が空の場合はチェックを行わないで、着工チェックフラグを立てる
            m_iScore(SCORE_NUM.WIRE) = PASS_SCORE_CHECKED
            Return True
        End If

        ' b-Site取得エラーチェック
        ' >> 2018/2/1 安部 WBAU,WBAG,WBCU の３種類を有効カテゴリに変更 RSB確認結果一覧：61 
        '        Dim getDataList = outMachine.MachineInf.MaterialInf.Where(Function(x) x.Category.Trim = BSITE_CATEGORY_WIRE And x.Type IsNot Nothing And x.OriginalLot IsNot Nothing And x.DueDate IsNot Nothing).ToList
        Dim getDataList = outMachine.MachineInf.MaterialInf.Where(Function(x) (x.Category.Trim = BSITE_CATEGORY_WIREAU Or x.Category.Trim = BSITE_CATEGORY_WIREAG Or x.Category.Trim = BSITE_CATEGORY_WIRECU) And x.Type IsNot Nothing And x.OriginalLot IsNot Nothing And x.DueDate IsNot Nothing).ToList
        ' << 2018/2/1 安部 WBAU,WBAG,WBCU の３種類を有効カテゴリに変更 RSB確認結果一覧：61 
        If getDataList.Count = 0 Then
            MsgBox(getMsgStr("MSG00101", lbl0100.Text))
            lbl0103.BackColor = ERROR_INIT_COLOR
            m_iScore(SCORE_NUM.WIRE) = PASS_SCORE_WAIT_CHECK
            Return False
        End If

        '製造条件でリストを検索
        Dim getData = getDataList.FirstOrDefault(Function(x) x.Type = lbl0102.Text.Split(DEF_SLASH)(0).Trim)
        If getData Is Nothing Then
            MsgBox(getMsgStr("MSG10030", lbl0100.Text, makeViewMachineTypeString(getDataList)))
            lbl0103.BackColor = ERROR_INIT_COLOR
            lbl0103.Text = String.Empty
            m_iScore(SCORE_NUM.WIRE) = PASS_SCORE_WAIT_CHECK
            Return False
        End If
        lbl0103.Text = getData.Type.Trim
        lbl0104.Text = getData.OriginalLot.Trim
        lbl0106.Text = getData.DueDate.Trim

        If Not checkExpirationDate(lbl0106, lbl0100.Text, SCORE_NUM.WIRE) Then
            Return False
        End If

        ' 着工チェックフラグを立てる
        m_iScore(SCORE_NUM.WIRE) = PASS_SCORE_CHECKED
        Return True
    End Function

    ' 線材補充ボタン
    Private Sub btnWireAdd_Click(sender As Object, e As EventArgs) Handles btnWireAdd.Click
        '外部EXEを呼び出す
        Dim strRetStatus As String = Execute_Command(lblProcessCD.Text, EXEC_PG_TAG_WIRE, txtLotNo.Text, g_EQUIP_NO, "", UserNo)
        '戻り値による処理は未定のため、現在は未実装
        If strRetStatus = "0" Then
            ' bSite連携
            getBsiteData()
            'Dim rd As New receiveCommandData
            'rd.matType = EXEC_PG_TAG_WIRE
            'setChangeForPQC(rd)
        Else
            MsgBox(getMsgStr("MSG10009", strRetStatus))
        End If
    End Sub
    Overrides Sub jyokenRefresh()
        getBsiteData()
    End Sub
    Overrides Function chkMatChanged() As Boolean
        Dim pqc As New clsPQCCheck
        Dim katamei As String = ""
        Dim matlot As String = ""
        Dim rtn As Boolean = False
        pqc.selectPQC(lblEquipID.Text, katamei, matlot)

        If katamei = "" And lbl0103.Text <> "" Then
            pqc.insertPQC(lblEquipID.Text, lbl0103.Text, matlot)
            rtn = False
        End If
        If katamei <> "" Then
            If katamei = lbl0103.Text Then
                rtn = False
            Else
                If lbl0103.Text <> "" Then
                    pqc.updatePQC(lblEquipID.Text, lbl0103.Text, matlot)
                    setChangeForPQC(EXEC_PG_TAG_WIRE)
                End If
                rtn = True
            End If
        End If
        Return rtn
    End Function

    ' キャピラリ補充ボタン
    Private Sub btnCapillaryAdd_Click(sender As Object, e As EventArgs) Handles btnCapillaryAdd.Click
        '外部EXEを呼び出す
        Dim strRetStatus As String = Execute_Command(lblProcessCD.Text, EXEC_PG_TAG_CAPILLARY, txtLotNo.Text, g_EQUIP_NO, "", UserNo)
        '戻り値による処理は未定のため、現在は未実装
        If strRetStatus = "0" Then
            ' bSite連携
            getBsiteData()
            'Dim rd As New receiveCommandData
            'rd.matType = EXEC_PG_TAG_CAPILLARY
            setChangeForPQC(EXEC_PG_TAG_CAPILLARY)
        Else
            MsgBox(getMsgStr("MSG10009", strRetStatus))
        End If
    End Sub

    ' 表示更新ボタン
    Private Sub btnViewRefresh_Click(sender As Object, e As EventArgs) Handles btnViewRefresh.Click
        makeRackListView()
        If IsNothing(IcTag.szLotNo) = False AndAlso IsNothing(m_cWBRackMng) = False Then
            txt0902.Text = m_cWBRackMng.GetShelfAdrFC(IcTag.szLotNo)
        End If

    End Sub

    '再読込ボタン押下
    Private Sub btnRefresh_Click_1(sender As Object, e As EventArgs) Handles btnRefresh.Click
        getBsiteData()
    End Sub

    ' Multiサービスを使用する場合はOverrideする
    Overrides Function IsBsiteMulti() As Boolean
        Return True
    End Function
    'ADD 苗 2018/1/7 BEGIN
    Protected Overrides Function getMutliStatus() As Double
        Dim strStatus As String
        strStatus = m_cWBRackMng.getStatusForOneEquip(IcTag.szLotNo, g_EQUIP_NO) 'UPD 苗 2018/1/19 装置No.の対応
        If strStatus = "1" Then
            Return ProcessStatus.TempProcessing

        ElseIf strStatus = "2" Or strStatus = "0" Then
            Return ProcessStatus.TempComplete
        End If
        Return ProcessStatus.Hold
    End Function
    '画面上の×印数、×印枚数、フレーム数を設定する。
    Protected Overrides Sub setCntFromMutliRacks()
        Dim SUM_ERR_INN_NUM As Integer = 0
        Dim SUM_ERR_INN_FRM_NUM As Integer = 0
        Dim SUM_FRAME_NUM As Integer = 0
        If m_cWBRackMng.getSum(lotNo, SUM_ERR_INN_NUM, SUM_ERR_INN_FRM_NUM, SUM_FRAME_NUM) Then


            'フレーム枚数=廃棄フレーム枚数の合計
            lblPcbCnt.Text = lblPcbCnt.Text - (SUM_FRAME_NUM + txtToNum(lbl0702.Text))

            lblCrossCnt.Text = txtToNum(lblCrossCnt.Text) + (txtToNum(lbl0703.Text) + SUM_ERR_INN_NUM) 'X印数
            lblCrossPcbCnt.Text = txtToNum(lblCrossPcbCnt.Text) + (txtToNum(lbl0704.Text) + SUM_ERR_INN_FRM_NUM) 'X印枚数

        End If
    End Sub

    'ADD 苗 2018/1/7 END

    'ADD 苗 2018/1/13 Begin
    Public Function txtToNum(strText As String) As Integer
        Dim intNum As Integer = CInt("0" + strText)
        Return intNum
    End Function

    Protected Overrides Function chkCrossFrame() As Boolean

        Dim SUM_ERR_INN_NUM As Integer = 0
        Dim SUM_ERR_INN_FRM_NUM As Integer = 0
        Dim SUM_FRAME_NUM As Integer = 0
        If m_cWBRackMng.getSum(lotNo, SUM_ERR_INN_NUM, SUM_ERR_INN_FRM_NUM, SUM_FRAME_NUM) Then
            '入力した廃棄フレーム数を計算し、負数となったら、エラーが表示する
            If (lblPcbCnt.Text - (SUM_FRAME_NUM + txtToNum(lbl0702.Text))) < 0 Then
                MsgBox(getMsgStr("MSG10012", lbl0700.Text, lblOutPutTxt3.Text)) 'UPD 苗 2018/4/13
                lbl0702.Focus()
                lbl0702.BackColor = ERROR_INIT_COLOR
                Return False
            End If
            '入力したX印枚数の合計＞計算後のフレーム枚数の場合、エラーが表示する。
            If (txtToNum(lbl0704.Text) + SUM_ERR_INN_FRM_NUM) > (lblPcbCnt.Text - (SUM_FRAME_NUM + txtToNum(lbl0702.Text))) Then
                MsgBox(getMsgStr("MSG10012", lblOutPutTxt5.Text, lblOutPutTxt3.Text)) 'UPD 苗 2018/4/13
                lbl0704.Focus()
                lbl0704.BackColor = ERROR_INIT_COLOR
                Return False
            End If
        End If

        Return True
    End Function
    '着工キャンセル前の処理
    Protected Overrides Sub clearData()
        ' >> 20180712 佐川 ラックID入力追加
        For i = 2 To 6
            '前工程ラックNoの入力数確認
            Dim rackText As Control() = Me.Controls.Find(String.Format("txt050{0}", i), True)
            If CType(rackText(0), TextBox).Text.Length > 0 Then
                'Rackデータの値を着工待ちの状態に戻す。
                m_cWBRackMng.UpdateRackData(IcTag.szLotNo, "0", CType(rackText(0), TextBox).Text, "", "", "", "", "", "", "")
            End If
        Next
        'm_cWBRackMng.UpdateRackData(IcTag.szLotNo, "0", txt0502.Text, "", "", "", "", "", "", "")
        ' << 20180712 佐川 ラックID入力追加
        txt0502.Text = String.Empty
        txt0602.Text = String.Empty
        lbl0702.Text = String.Empty
        lbl0703.Text = String.Empty
        lbl0704.Text = String.Empty
        ' >> 20180712 佐川 ラックID入力追加
        txt0503.Text = String.Empty
        txt0504.Text = String.Empty
        txt0505.Text = String.Empty
        txt0506.Text = String.Empty
        txt0603.Text = String.Empty
        txt0604.Text = String.Empty
        txt0605.Text = String.Empty
        txt0606.Text = String.Empty
        ' << 20180712 佐川 ラックID入力追加

    End Sub
    'ADD 苗 2018/1/13 END

    '計上完成正常時の画面初期化
    Protected Overrides Sub initializForm()
        PutLog(Me.ToString, "initializForm", " WB initializForm") '2020/8/8 ver.58

        MyBase.initializForm()
        InputDataClear()
        txt0502.Text = String.Empty
        txt0602.Text = String.Empty
        txt0902.Text = String.Empty
        lblEmptyChips.Text = "0"
    End Sub

    'バーコード入力タブキー対応
    Private Sub txtData_PreviewKeyDown(ByVal sender As Object, ByVal e As PreviewKeyDownEventArgs) _
        Handles txt0502.PreviewKeyDown, txt0602.PreviewKeyDown, txt0902.PreviewKeyDown,
        txt0503.PreviewKeyDown, txt0504.PreviewKeyDown, txt0505.PreviewKeyDown, txt0506.PreviewKeyDown, txt0603.PreviewKeyDown, txt0604.PreviewKeyDown, txt0605.PreviewKeyDown, txt0606.PreviewKeyDown ' ADD 20180712 ラックID入力追加
        'タブキーが押下された場合は、改行コードと見なし処理を行う
        If e.KeyCode = Keys.Tab Then
            e.IsInputKey = True
            txtData_KeyPressWB(sender, New KeyPressEventArgs(vbCr)) ' 20180322 大賀 No120 Tabキーで着工されない
        End If
    End Sub


    '>>2018/1/31 佐川 キャリア交換対応
    'IcTag保存内容設定
    Protected Overrides Sub icTagDataSet()
        '製造完成、計上完成時は画面入力値の値を設定する。
        If execMode.Equals(COMPLETE) Or execMode.Equals(TOTAL) Then
            IcTag.container1 = lblAfterRack1.Text
            IcTag.container2 = lblAfterRack2.Text
            IcTag.container3 = lblAfterRack3.Text
            IcTag.container4 = lblAfterRack4.Text
            IcTag.container5 = lblAfterRack5.Text

            Dim rackNo As New ArrayList
            Dim dbLot As New clsDbLotDefect
            If lblAfterRack1.Text <> "" Then
                rackNo.Add(lblAfterRack1.Text)
            End If
            If lblAfterRack2.Text <> "" Then
                rackNo.Add(lblAfterRack2.Text)
            End If
            If lblAfterRack3.Text <> "" Then
                rackNo.Add(lblAfterRack3.Text)
            End If
            If lblAfterRack4.Text <> "" Then
                rackNo.Add(lblAfterRack4.Text)
            End If
            If lblAfterRack5.Text <> "" Then
                rackNo.Add(lblAfterRack5.Text)
            End If
            dbLot.DelInsRackInfo(IcTag.szLotNo, rackNo)

        Else
            '初期値をそのまま保存するため、変更しない。
        End If
    End Sub
    '<<2018/1/31 佐川 キャリア交換対応

    ' >> 20180307 大賀 作業者入力確定時に次の入力にフォーカスを移動する
    ''' <summary>
    ''' 作業者入力後のフォーカスを各画面で設定する
    ''' 各画面でオーバーライドされない場合はTabIndex順に移動する
    ''' </summary>
    ''' <param name="inputType">作業者入力タイプ</param>
    ''' <param name="nowControl">対象コントロール</param>
    Protected Overrides Sub setNextFocus(ByVal inputType As OPERATER_INPUT_TYPE, ByVal nowControl As Control)
        If m_ProcessStatus <> ProcessStatus.Ready Then  ' ロット未入力の場合は処理しない
            If IcTag.Status = TagProcessStatus.Ready Then   ' 未着工
                If inputType = OPERATER_INPUT_TYPE.START_OPE Then
                    tabBase.SelectedTab = TabPageSp ' タブの移動
                    If String.IsNullOrEmpty(txt0502.Text) Then  ' 未入力の場合に入力可能にする
                        btnPreRackNo.PerformClick()  ' バーコード入力ボタンを押す
                        Exit Sub
                    End If
                End If
            ElseIf IcTag.Status = TagProcessStatus.Processing Then  ' 着工中

            ElseIf IcTag.Status = TagProcessStatus.ManufComplete Then ' 製造完成

            End If
        End If
        ' 各画面個別のフォーカスに移動しない場合は次のTabIndexに移動
        SelectNextControl(nowControl, True, True, True, True)
    End Sub
    ' << 20180307 大賀 作業者入力確定時に次の入力にフォーカスを移動する

    '>>20180329 大賀 No125 S42で最後の完成を実施しても臨時完成となる場合がある
    'bSite通信に失敗した場合にwb_rack_mngを更新するためオーバライドする
    Overrides Sub CommandFailed()
        If m_cWBRackMng.IsCheckRackStatus(IcTag.szLotNo, WB_BSITE_SENDING, txt0502.Text, g_EQUIP_NO) Then
            ' ステータスが通信中の場合、着工中のステータスに戻す
            m_cWBRackMng.UpdateRackData(IcTag.szLotNo, TagProcessStatus.Processing, txt0502.Text, txt0602.Text,
                                    g_EQUIP_NO, txt0902.Text, lbl0702.Text, lbl0703.Text, lbl0704.Text, mLocationCode)
        End If
        MyBase.CommandFailed()
    End Sub
    '<<20180329 大賀 No125 S42で最後の完成を実施しても臨時完成となる場合がある

    ' >> 20180712 佐川 ラックID入力追加
    '入力ラック数チェック
    Private Function isCheckInputRack()
        Dim rackCount As Integer = 0
        Dim afterRackCount As Integer = 0

        For i = 2 To 6
            '前工程ラックNoの入力数確認
            Dim rackText As Control() = Me.Controls.Find(String.Format("txt050{0}", i), True)
            If CType(rackText(0), TextBox).Text.Length > 0 Then
                rackCount = rackCount + 1
            End If

            '完了ラックNoの入力数確認
            Dim afterRackText As Control() = Me.Controls.Find(String.Format("txt060{0}", i), True)
            If CType(afterRackText(0), TextBox).Text.Length > 0 Then
                afterRackCount = afterRackCount + 1
            End If
        Next

        '前工程ラック数と完了ラック数が同じ場合はTrueを返却する
        If rackCount = afterRackCount Then
            '処理件数を更新する
            inputCount = rackCount
            Return True
        Else
            Return False
        End If
    End Function
    ' << 20180712 佐川 ラックID入力追加
    ' >> 20180712 佐川 ラックNo途入力改善
    Public Overrides Sub rackInputFocus(ByVal sender As Object, ByVal e As System.EventArgs)
        '未着工のみ選択可能にする
        If IcTag.Status = TagProcessStatus.Ready Then
            MyBase.rackInputFocus(sender, e)
        End If
    End Sub
    ' << 20180712 佐川 ラックNo途入力改善

    '--自動着完工用実装分--BEGIN　2019/11/29
    Protected Overrides Sub setBeforeRackNo(Optional inputRackNo As String = "")

        If inputRackNo <> "" Then
            txt0502.Text = inputRackNo
            'm_iScore(SCORE_NUM.PRE_RACK_NO) = PASS_SCORE_CHECKED
            If AUTO_MANUAL_BTN = TYPE_AUTO Then
                '    m_iScore(SCORE_NUM.AFTER_RACK_NO) = PASS_SCORE_CHECKED
                m_iScore = {PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED}

            End If
        End If
        If AUTO_MANUAL_BTN = TYPE_AUTO Then
            If txt0502.Text <> "" Then
                m_iScore = {PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED}
            End If
        ElseIf AUTO_MANUAL_BTN = TYPE_MANUAL Then
            If txt0502.Text <> "" And txt0602.Text <> "" Then
                m_iScore = {PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED, PASS_SCORE_CHECKED}

            End If
        End If

    End Sub

    Protected Overrides Function setAfterRackNo(receiveData As receiveCommandData) As Boolean
        If receiveData.UrackNoList.Count = 0 Then
            Return False
        End If
        '完工MS料盒设置
        If IsNothing(receiveData.UrackNoList(0)) = False Then
            txt0602.Text = receiveData.UrackNoList(0)
        End If
        Return True
    End Function
    ''' <summary>
    ''' 设置画面控件是否可用
    ''' </summary>
    ''' <param name="mode">True:自动状态，False：手动状态</param>
    Protected Overrides Sub setAutoScreen(mode As Boolean)

        Dim setColor As Color = NORMAL_INIT_COLOR
        Dim setEnabled As Boolean = Not (mode)

        '完工后，是否清空画面，清空后ictag也被清空（手动时为true,自动时为false)
        initializForm_FLG = setEnabled

        If mode = True Then
            setColor = NORMAL_INIT_COLOR
        Else
            setColor = BUTTON_INIT_COLOR
        End If
        '受入MSラック
        txt0502.Enabled = setEnabled
        txt0503.Enabled = setEnabled
        txt0504.Enabled = setEnabled
        txt0505.Enabled = setEnabled
        txt0506.Enabled = setEnabled
        '完工MSラック
        txt0602.Enabled = setEnabled
        txt0603.Enabled = setEnabled
        txt0604.Enabled = setEnabled
        txt0605.Enabled = setEnabled
        txt0606.Enabled = setEnabled

        '背景色設定
        '受入MSラック
        txt0502.BackColor = setColor
        txt0503.BackColor = setColor
        txt0504.BackColor = setColor
        txt0505.BackColor = setColor
        txt0506.BackColor = setColor

        lbl0502.BackColor = setColor
        lbl0503.BackColor = setColor
        lbl0504.BackColor = setColor
        lbl0505.BackColor = setColor
        lbl0506.BackColor = setColor

        '完工MSラック
        txt0602.BackColor = setColor
        txt0603.BackColor = setColor
        txt0604.BackColor = setColor
        txt0605.BackColor = setColor
        txt0606.BackColor = setColor

        lbl0602.BackColor = setColor
        lbl0603.BackColor = setColor
        lbl0604.BackColor = setColor
        lbl0605.BackColor = setColor
        lbl0606.BackColor = setColor

        btnPreRackNo.Enabled = setEnabled
        btnAfterRackNo.Enabled = setEnabled
        btnShelfNo.Enabled = setEnabled

        If mode = False Then
            btnLotTxt.PerformClick()
            btnLotTxt.PerformClick()
            'btnPreRackNo.PerformClick()
        End If
    End Sub
    Overrides Sub setKeyNoAfferControlFocus() 'add miaojf 2020/8/12 ver.60
        If AutoManualMode = 0 And AUTO_MANUAL_BTN = TYPE_AUTO Then
        Else
            btnPreRackNo.PerformClick()
        End If
    End Sub
    ''' <summary>
    ''' 材料区分が本工程の区分かどうか判断
    ''' </summary>
    ''' <param name="materialType">材料区分</param>
    ''' <returns>判断結果</returns>
    Protected Overrides Function chkMaterialType(materialType As String) As Boolean
        Dim rtn As Boolean = False

        'If EXEC_PG_TAG_WIRE.Contains(materialType.ToUpper) Or EXEC_PG_TAG_CAPILLARY.Contains(materialType.ToUpper) Then
        '    rtn = True
        'End If
        If Trim(materialType) = "5" Or Trim(materialType) = "6" Then
            rtn = True
        End If
        Return rtn
    End Function

    ''' <summary>
    ''' atlasの材料補充を呼び出す
    ''' </summary>
    ''' <param name="materialType">材料区分</param>
    ''' <param name="mat">材料名</param>
    Protected Overrides Sub callAtlasExec(materialType As String, mat As String)

        Dim strMaterialType As String = ""

        If Trim(materialType) = "5" Then
            strMaterialType = EXEC_PG_TAG_WIRE
        ElseIf Trim(materialType) = "6" Then
            strMaterialType = EXEC_PG_TAG_CAPILLARY
        End If
        If strMaterialType = "" Then Exit Sub


        '外部EXEを呼び出す
        Dim strRetStatus As String = Execute_Command(lblProcessCD.Text, strMaterialType, txtLotNo.Text, g_EQUIP_NO, mat, UserNo)
        '戻り値による処理は未定のため、現在は未実装
        If strRetStatus = "0" Then
            ' bSite連携
            bsiteRtn = getBsiteData()
        Else
            MsgBox(getMsgStr("MSG10009", strRetStatus))
        End If
    End Sub

    Private Sub btnCheckInfoClose_Click(sender As Object, e As EventArgs)
        pnlCheckInfo.Visible = False
        txtChkInfo.Text = ""
    End Sub

    'Protected Overrides Function getRackCount() As Integer
    '    Dim count As String = 0
    '    If txt0502.Text <> "" Then count = count + 1
    '    If txt0503.Text <> "" Then count = count + 1
    '    If txt0504.Text <> "" Then count = count + 1
    '    If txt0505.Text <> "" Then count = count + 1
    '    If txt0506.Text <> "" Then count = count + 1
    '    Return count
    'End Function

    Protected Overrides Sub doRandCheck(dtmst As DataTable, dtRecords As DataTable)
        Dim objRCHistory As New clsRandCheckHistory
        Dim objRecords As New clsRandCheckRecords
        Dim frameCount As Integer = 0
        '抜取検査履歴追加
        ''MSTの抜取検査数がある場合：履歴追加
        If dtmst.Rows(0)("CheckNum") <> 0 Then
            strDP_CNT = m_cData.getDTCount(IcTag.szLotNo)
            If strDP_CNT.Equals("0") = False Then
                frameCount = Math.Ceiling(dtmst.Rows(0)("CheckNum") / CInt(strDP_CNT))
            End If
            objRCHistory.insertData(IcTag.szLotNo, IcTag.szProcsCD, txt0502.Text, lblEquipID.Text, txtOptNoStt.Text, getInvNumByRackID, dtmst.Rows(0)("CheckNum"), frameCount, dtmst.Rows(0)("NGNum"), 0, "", RC_TYPE)
            setRandCheckInfo("料盒：" & txt0502.Text)

        End If
        ''MSTの抜取検査数がない場合：AQLテーブルでAQLの抜取検査数を検索し、履歴追加
        If IsDBNull(dtmst.Rows(0)("CheckNum")) OrElse dtmst.Rows(0)("CheckNum") = 0 Then
            Dim objAQL As New clsSampleNumAQL
            Dim rdChecknum As Integer = 0
            Dim NGNum_DEF As Integer
            Dim dt As DataTable
            Dim tmpSuminvnum As Integer = 0

            If dtRecords.Rows.Count > 0 Then tmpSuminvnum = dtRecords.Rows(0)("SUMINVNUM")

            dt = objAQL.selectAQLValue(tmpSuminvnum + getInvNumByRackID(), dtmst.Rows(0)("CHECKFREQ"))
            If dt.Rows.Count > 0 Then
                rdChecknum = dt.Rows(0)("CheckNum")
                NGNum_DEF = dt.Rows(0)("ngNum")
                strDP_CNT = m_cData.getDTCount(IcTag.szLotNo)
                If strDP_CNT.Equals("0") = False Then
                    frameCount = Math.Ceiling(dt.Rows(0)("CheckNum") / CInt(strDP_CNT))
                End If
                objRCHistory.insertData(IcTag.szLotNo, IcTag.szProcsCD, txt0502.Text, lblEquipID.Text, txtOptNoStt.Text, getInvNumByRackID, rdChecknum, frameCount, NGNum_DEF, 0, "", RC_TYPE)
                setRandCheckInfo("料盒：" & txt0502.Text)
            End If
        End If
        '記録削除
        objRecords.deleteRecords(lblEquipID.Text)

    End Sub
    Overrides Sub setRandCheckInfo(Str As String)
        Me.pnlCheckInfo.Visible = True
        Me.pnlCheckInfo.BringToFront()

        txtChkInfo.Text = getMsgStr("MSG10058", "料盒：" & txt0502.Text) & vbCrLf
    End Sub
    Protected Overrides Sub dontRandCheck(dtRecords As DataTable, ProdName As String, PKG As String, countNum As Integer)
        Dim objRecords As New clsRandCheckRecords

        '記録がある場合修正、ない場合の追加
        If dtRecords.Rows.Count = 0 Then
            objRecords.insertRecords(lblEquipID.Text, ProdName, PKG, countNum, getInvNumByRackID)
        Else
            objRecords.updateRecords(lblEquipID.Text, dtRecords.Rows(0)("CountNum") + countNum, dtRecords.Rows(0)("SUMINVNUM") + getInvNumByRackID())
        End If


    End Sub
    Public Overrides Function AProcCD() As String
        Return PROC_CD_WBA

    End Function
    Private Function getInvNumByRackID() As Integer
        Dim objDBLot As New clsDbLotDefect
        Dim intInvNum As Integer = 0
        intInvNum = objDBLot.getInvNumByRackID(lblProcessCD.Text, IcTag.szLotNo, txt0502.Text)
        Return intInvNum
    End Function
    Overrides Function isRackNoFlow()
        Return True
    End Function
    Protected Overrides Sub updateRCRackID()
        Dim objRCHistory As New clsRandCheckHistory
        objRCHistory.updateRackNo(IcTag.szLotNo, lblProcessCD.Text, tmpInRackNo, tmpOutRackNo)
    End Sub
    Overrides Function getInRackNo() As String
        Return txt0502.Text
    End Function

    Overrides Function checkBsiteMachineInf() As Boolean
        Return getBsiteData()
    End Function

    Overrides Function isSameRackNo(rackNo As String) As Boolean
        If rackNo = txt0502.Text Then
            Return True
        Else
            Return False
        End If
        Return True
    End Function

    Overrides Function doSendNPtoMPCinBase() As Boolean
        Return False
    End Function
    Overrides Sub SendNPtoMPC()
        PutLog(Me.ToString, "WBSNPMPC", "AutoManualMode=" & AutoManualMode)
        If AutoManualMode = 0 Then
            Dim rtnIU As String
            Dim rtnNP As String
            'ADD 2020/9/12 miaojf Ver.80
            If IsNothing(outHeader) Then
                PutLog(Me.ToString, "WBSNPMPC", "outHeader=isnothing")
                Exit Sub
            End If
            If STS_SUCCESS.Equals(outHeader.Status) Then
                rtnIU = COMMAND_OK
                rtnNP = OK
                NP_IU_RTN = True 'ADD 2020/8/17 miaojf Ver.70
                updateRackInfo()
            Else
                NP_IU_RTN = False 'ADD 2020/8/17 miaojf Ver.70
                rtnIU = COMMAND_NG
                rtnNP = NG
            End If
            Dim strMPCCommand As String
            'TODO:追加要
            'NPコマンドを送信
            'UPD MIAO 2020/09/03 begin Ver.71 
            If IcTag.szLotNo <> "" Then
                With IcTag
                    strMPCCommand = createStORCompCommandStr(COMMAND_NP, rtnNP, .szLotNo, .szDifLotNo, lblProcessCD.Text, g_CURRENT_EQUIP_ID,
                                lblEquipID.Text, "", "", txtOptNoEnd.Text, lblkindNm.Text, lblShape.Text, lblPbLayout.Text, "")
                End With
            Else
                With NPP
                    strMPCCommand = createStORCompCommandStr(COMMAND_NP, rtnNP, .szLotNo, .szDifLotNo, .ProcessCD, .EQUIP_ID,
                                .EQUIP_No, "", "", .OptNoEnd, .kindNm, .Shape, .PbLayout, "")

                End With
            End If
            'UPD MIAO 2020/09/03 end Ver.71 
            PutLog(Me.ToString, "WB sendCommand", strMPCCommand)
            m_cEquipCommandControl.CommandSend(strMPCCommand)

            'IUコマンドを送信
            'If LH_FLAG = True Then
            sendResponseCommand(COMMAND_IU, rtnIU)
            'End If
            ''ADD 2020/8/17 miaojf Ver.70
            ''当bsite计上成功，且 已有等待执行的LN时，调用方法进行执行，执行完删除等待指令
            'If NP_IU_RTN = True And IsNothing(WaitLnCommand) = False Then
            '    initializForm()
            '    CommandReceive(WaitLnCommand)
            '    WaitLnCommand = Nothing6
            'End If
            LN_FLAG = False
            LH_FLAG = False
        End If
    End Sub

    Public Overrides Function setBufferLN() As Boolean
        Return True
    End Function

    Overrides Sub totalCompAfter()
        '当用户点击【计上完成】按钮时，也经发指令给MPC

    End Sub
    'Overrides Sub setInitializForm_FLG()
    '    initializForm_FLG = True
    'End Sub
    Overrides Sub clearForm()
        initializForm()
    End Sub
    Overrides Function chkLN() As Boolean
        Return m_cWBRackMng.chkRackStatus(IcTag.szLotNo, TagProcessStatus.Ready, txt0502.Text, g_EQUIP_NO)
    End Function
    Overrides Function chkLH() As Boolean
        Return m_cWBRackMng.chkRackStatus(IcTag.szLotNo, TagProcessStatus.Processing, txt0502.Text, g_EQUIP_NO)
    End Function
    Overrides Function chkAuto() As Boolean
        If m_cWBRackMng.chkRackAuto(IcTag.szLotNo, txt0502.Text) = False Then
            setCheckInfo(getMsgStr("MSG10063", txt0502.Text))
            Return False
        End If
        Return True
    End Function

    'Private Sub Button4_Click(sender As Object, e As EventArgs)
    '    Dim sendCommand = "LCEWB50000926                    M01P00P                                                            S                              LZYD407000A                    G06740N00000F00113C                              C064P6Q-5-CU-N-A                                             M00040WG00001107866                  PR5F10WLGAFB-10                P00C0B01"
    '    m_cEquipCommandControl.CommandSend(sendCommand)
    'End Sub
End Class